Saurabh Sharma Saurabh Sharma - 5 months ago 36
PHP Question

Mod_rewrite handling extra get variables (QSA not working)

I have a mod rewrite rule for settings page: (localhost/settings/index.php)

RewriteRule settings/([a-zA-Z0-9_]+)/?$ settings/?path=$1 [QSA,L]

And I am handling menu references within the URL which will be similar to:


However, with my current rewrite rule, the variable does not get passed along and I didn't get the values of ref,abc..

I read here about QSA flag but that doesn't seem to be working.

What am I doing wrong?


Try turning off MultiViews option:

Options -MultiViews
RewriteEngine On

RewriteRule ^settings/([\w-]+)/?$ settings/?path=$1 [QSA,L,NC]

In place of QSA, you can use this trick to captured query string:

RewriteRule ^settings/([\w-]+)/?$ settings/?path=$1&%{QUERY_STRING} [L,NC]