2

I'm using this rewrite rule for my whole domain:

RewriteRule ^([A-Za-z0-9/-]+)$ /index.php?path=$1

So for example, my urls look like this:

http://www.example.com/page/subpage/4/anything/

The problem is when I want to manually add a specific $_GET, like this:

http://www.example.com/page/subpage/4/anything/?also=admin

I remember this has worked on some sites I've been developing, but it doesn't work here.

How can I fix my RewriteRule so that I can add $_GET data like this?

4

2 に答える 2

7

Use Query String Append (QSA):

RewriteRule ^([A-Za-z0-9/-]+)$ /index.php?path=$1 [QSA]
于 2012-11-26T19:25:49.417 に答える
1

Add as second rule that looks for URLs with ? in them:

RewriteRule ^([A-Za-z0-9/-]+)\?(.*) /index.php?path=$1&$2
于 2012-11-26T19:25:48.433 に答える