Forum Moderators: phranque
I've wrote this :
RewriteCond %{HTTP_HOST} ^www\.example\.com
RewriteCond %{REQUEST_URI} !^/forums/([^.]+)?$
RewriteRule ^(.+)/(.+)/$ index.php?act1=$1&act2=$2 [L]
to solve this :
http://www.example.com/action1/action2/
and it works fine.
But when I try this url :
http://www.example.com/action1/action2/?test=yes
It doesn't give me the $_GET['test'].
How can I fix that ?
Your RewriteRule pattern can be improved for efficiency and specificity. Try:
RewriteRule ^([^/]+)/([^/]+)/$ index.php?act1=$1&act2=$2 [QSA,L]
You will have to decide if the pattern you show here is sufficient. it will accept a URL-path of /<anything-but-a-slash>/<anything-but-a-slash>. So, yes, this will redirect a request for "/foo/bar" to "/foo/bar/".
But it will also redirect a request for "/images/logo.gif" to "/images/logo.gif/" which is not likely what you would want. Generally, I would recommend at least a slightly-more-restrictive pattern of
RewriteRule ^([^/]+)/([b][^/.][/b]+)$ http://www.example.com/$1/$2/ [R=301,L]
Jim