问题
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?
回答1:
Use Query String Append (QSA):
RewriteRule ^([A-Za-z0-9/-]+)$ /index.php?path=$1 [QSA]
回答2:
Add as second rule that looks for URLs with ? in them:
RewriteRule ^([A-Za-z0-9/-]+)\?(.*) /index.php?path=$1&$2
来源:https://stackoverflow.com/questions/13571632/why-does-my-rewrite-rule-disables-additional-get-data