John Smith John Smith - 1 year ago 101
Apache Configuration Question

htaccess removes the GET variables

I am editing a script and need to read GET variables to make my job done. But it seems the .htaccess file is manipulating it and removes everything at the end of custom URLs. I have no idea how to modify apache configurations to make it to works fine for the script yet me.

Options +FollowSymLinks
RewriteEngine on
RewriteBase /

<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)$ index.php?route=$1/$2 [L]

<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?route=$1 [L]

Here is a sample of URL I need to call:


and the $_GET only contains one 'route' key with the value below:


And other query strings are missed. What should I do for having them?

Answer Source

You probably want the QSA: Query String Append rewrite flag which does what it says on the tin.

For example:

RewriteRule ^(.*)/(.*)$ index.php?route=$1/$2 [L,QSA]

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download