有人可以告诉我如何编写重写规则:我有许多链接看起来像:
我想将所有这些内容重定向到http://www.mavrica.com/fotogalerije/
所有链接都有共同的第一部分(最多为tx_cms_showpic)。
我尝试了以下htaccess
规则:
RewriteRule /index.php?eID=tx_cms_showpic$ http://mavrica.com/fotogalerije/ [R=301]
和
RedirectMatch 301 ^/index.php?eID=tx_cms_showpic(.*) http://www.mavrica.com/fotogalerije/
但它们都不起作用。
我错过了什么?
感谢您的帮助!
答案 0 :(得分:2)
您需要使用%{QUERY_STRING}
来捕获和/或匹配网址的查询字符串部分:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+index\.php\?eID=tx_cms_showpic [NC]
RewriteRule ^ http://mavrica.com/fotogalerije/? [R=301,L]