mod_rewrite does not onward GET parameters
I'm having problem establishing Apache with mod_rewrite on my growth equipment. Mod_rewrite is energetic, and also functions well for some regulations. Some regulations do not function as planned, similar to this one:
RewriteRule ^static/([^/]+)/([^/]+) /static.php?sISOCode=$1&sPage=$2
In static.php I do this (for debugging) :
<?php print_r($_GET); print_r($_POST); print_r($_SERVER); die();
Which prints (got rid of some things from the $_ SERVER array) :
Array ( ) Array ( ) Array ( [SERVER_SIGNATURE] => <address>Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch Server at alpha.prove.no Port 80</address> [SERVER_SOFTWARE] => Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch [SERVER_ADDR] => 127.0.0.1 [SERVER_PORT] => 80 [REMOTE_ADDR] => 127.0.0.1 [DOCUMENT_ROOT] => /home/veg/workspace/project [SERVER_ADMIN] => [email protected] [SCRIPT_FILENAME] => /home/veg/workspace/project/static.php [REMOTE_PORT] => 38954 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /static/no/startCar [SCRIPT_NAME] => /static.php [PATH_INFO] => /no/startCar [PATH_TRANSLATED] => redirect:/index.php/startCar [PHP_SELF] => /static.php/no/startCar [argv] => Array ( ) [argc] => 0 )
In some way the GET parameters set according to the regulation is not surviving. The same.htaccess documents remains in usage on various other arrangements, and also functions well. The Apache arrangement for this digital domain name:
<VirtualHost *:80> ServerAdmin [email protected] ServerName project.example.com DocumentRoot /home/veg/workspace/project <Directory /home/veg/workspace/project> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined </VirtualHost>
The accessibility log and also mistake log results absolutely nothing when this takes place. Any kind of suggestions valued.
An instance of a regulation that functions, for the very same documents:
RewriteRule ^faq/?$ /static.php?sISOCode=no&sPage=faq
The remedy was to transform the Apache arrangement, similar to this:
<VirtualHost *:80> ServerAdmin [email protected] ServerName project.example.com DocumentRoot /home/veg/workspace/project <Directory /home/veg/workspace/project> Options FollowSymLinks # AllowOverride All # Order allow,deny # allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined </VirtualHost>
I do not recognize why this functions, nonetheless
Have you attempted making use of the QSA (Query String Append) flag?
RewriteRule ^static/([^/]+)/([^/]+) /static.php?sISOCode=$1&sPage=$2 [QSA]
EDIT, AND ACTUAL ANSWER BELOW :
This trouble is brought on by Apache's mod_negotiation, specifically the MultiViews alternative you are making use of :
The result of MultiViews is as. adheres to : if the web server obtains a. ask for/ some/dir/foo, if. / some/dir has MultiViews made it possible for, and also. / some/dir/foo does not exist, after that the. web server reviews the directory site seeking. documents called foo. *, and also properly. counterfeits up a type map which names all. those documents, appointing them the very same. media kinds and also content-encodings it. would certainly have if the customer had actually requested for. among them by name. It after that picks. the most effective suit to the customer's. needs.
Making it possible for Multiviews informs Apache to presume which documents to make use of when the URI does not in fact indicate an existing area.
Disable multiviews by either making use of
-MultiViews in your.htaccess or leaving it out entirely.