query string broken after enable pretty url
Permalink
Hi all,
This is the problem: I am losing the url query string after enable pretty url. I enabled the pretty url from dashboard, modified the .htaccess file, and modified config/base.php and libraries/request.php to redirec always to pretty url and remove index.php from the URL. I created too a file called config/site_post.php to force concrete5 Pages to Display at One URL (redirect cID to pretty url).
I must to say that in the problem is present only in the server because in local all is working well.
this is the local configuration:
System Linux
Server API Apache 2.0 Handler
Configuration File (php.ini) Path /etc/php5/apache2
this is the server configuration:
System Linux
Server API CGI/FastCGI
Configuration File (php.ini) Path /etc/php5/cgi
bellow the code:
.htaccess in local
I must to change the .htaccess in the server in order to make it run:
local libraires/request.php
server libraires/request.php
after this modification i am able to access to my site.
config/site_post.php
config/base.php
as I said earlier, in local it is working well. If I do a vardump of $_GET on http://mysite.local/info/permalink/1... I can get an array whit proxy=true and idobj=1. In the server If I do a vardump I get an empty array.
what's wrong on server? Any help would be much appreciated.
This is the problem: I am losing the url query string after enable pretty url. I enabled the pretty url from dashboard, modified the .htaccess file, and modified config/base.php and libraries/request.php to redirec always to pretty url and remove index.php from the URL. I created too a file called config/site_post.php to force concrete5 Pages to Display at One URL (redirect cID to pretty url).
I must to say that in the problem is present only in the server because in local all is working well.
this is the local configuration:
System Linux
Server API Apache 2.0 Handler
Configuration File (php.ini) Path /etc/php5/apache2
this is the server configuration:
System Linux
Server API CGI/FastCGI
Configuration File (php.ini) Path /etc/php5/cgi
bellow the code:
.htaccess in local
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / #remove /index.php from home url and redirect to root. ej: http:mysite.local/index.php a http:mysite.local/ RewriteCond %{THE_REQUEST} ^.*\/index\.php?\ HTTP/ RewriteRule ^(.*)index\.php?$ "/$1" [R=301,L] #pretty url senza index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] #rewrite to handle some permalink RewriteRule ^([^/]+)/info/([a-zA-Z0-9\-]+)/([0-9]+) /info/?proxy=true&idobj=$3 [L]
I must to change the .htaccess in the server in order to make it run:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / #remove /index.php from home url and redirect to root. ej:http://mysite.local/index.php ahttp://mysite.local/ RewriteCond %{THE_REQUEST} ^.*\/index\.php?\ HTTP/ RewriteRule ^(.*)index\.php?$ "/$1" [R=301,L] #pretty url senza index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php [PT,QSA,L] #rewrite to handle some permalink saved on my db. http://mysite.local/info/permalink/1... http://mysite.local/info/proxy=true&idobj=1... RewriteRule ^([^/]+)/info/([a-zA-Z0-9\-]+)/([0-9]+) /info/?proxy=true&idobj=$3 [L]
local libraires/request.php
public static function get() { static $req; if (!isset($req)) { $path = false; if (defined('SERVER_PATH_VARIABLE')) { $path = Request::parsePathFromRequest(SERVER_PATH_VARIABLE); } if (!$path) { $path = Request::parsePathFromRequest('ORIG_PATH_INFO'); } if (!$path) { $path = Request::parsePathFromRequest('PATH_INFO'); } if (!$path) { $path = Request::parsePathFromRequest('SCRIPT_NAME');
Viewing 15 lines of 20 lines. View entire code block.
server libraires/request.php
public static function get() { static $req; if (!isset($req)) { $path = false; if (defined('SERVER_PATH_VARIABLE')) { $path = Request::parsePathFromRequest(SERVER_PATH_VARIABLE); } if (!$path) { //$path = Request::parsePathFromRequest('ORIG_PATH_INFO'); $path = Request::parsePathFromRequest('REDIRECT_SCRIPT_URL'); } if (!$path) { $path = Request::parsePathFromRequest('PATH_INFO'); } if (!$path) {
Viewing 15 lines of 21 lines. View entire code block.
after this modification i am able to access to my site.
config/site_post.php
<?php $req = Request::get(); if ($req->getRequestCollectionID() > 1 && $req->getRequestPath() == '' && $_SERVER['REQUEST_METHOD'] != 'POST' && !(Page::getByID($req->getRequestCollectionID())->isExternalLink())) { // This is a request that is directly for the cID, rather than the path $u = new User(); // If the user is logged in we do NOT redirect if (!$u->isRegistered()) { // Get the page object for the current cID $c = Page::getByID($req->getRequestCollectionID()); if (!$c->isError() ) { $nav = Loader::helper('navigation'); header ('HTTP/1.1 301 Moved Permanently'); header('Location: ' . $nav->getLinkToCollection($c, true)); exit;
Viewing 15 lines of 27 lines. View entire code block.
config/base.php
as I said earlier, in local it is working well. If I do a vardump of $_GET on http://mysite.local/info/permalink/1... I can get an array whit proxy=true and idobj=1. In the server If I do a vardump I get an empty array.
what's wrong on server? Any help would be much appreciated.