Question

I have the standard htaccess which just catches all and puts it into one url parameter which is later processed in code...

RewriteRule ^config/ - [F]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

I use "pretty" url params like

/some/route/param1/value1/param2/value2 

but now I need an ability to add "regular" url params like

/some/route/param1/value1?param2=value2&param3=value3 etc

I tried adding

RewriteRule ^(.*)\?(.*)$ index.php?q=$1&p=$2 [L,QSA]

before the existing rule, but it won't work properly (and I suspect it would only work with one parameter).

Was it helpful?

Solution

Try this:

RewriteRule ^([^?]+)\?(.*)$ index.php?q=$1&p=$2 [L,QSA]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top