Frage

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).

War es hilfreich?

Lösung

Try this:

RewriteRule ^([^?]+)\?(.*)$ index.php?q=$1&p=$2 [L,QSA]
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top