I want to rewrite a specific URL, I'll show an example so you'll understand what I mean.
First, my current rewrite rule:
Re开发者_StackOverflowwriteRule ^/?([a-zA-Z0-9/-]+)/?$ /index.php [NC,L]
Now I want this URL:
http://example.tld/foobar?test
Rewritten to:
http://example.tld/foobar
Note: only for /foobar?test
! E.g. not for /somethingelse?test
and also not for /foobar?blah
!
Thanks in advance!
EDIT: I realized I want a 301 redirect from /foobar?test
to /foobar
, not a "traditional" rewrite. Hope that is possible.
RewriteCond %{QUERY_STRING} ^test$
RewriteRule ^/foobar$ /foobar [NC,R=301,L]
精彩评论