我需要将一个动态URL重定向到另一个,但参数稍有变化。这是原始网址:
http://www.EXAMPLE.com/index.php?main_page=index&cPath=5
它需要重定向到
http://www.EXAMPLE.com/index.php?main_page=index&cPath=25
我尝试了许多不同的变体,但似乎没有一个奏效。
RewriteCond %{QUERY_STRING} ^main_page=index&cPath=5$
RewriteRule ^/(index\.php|)$ http://www.EXAMPLE.com/index.php?main_page=index&cPath=25 [L,R=301]
我为此感到疯狂……有人能指出我正确的方向并告诉我我做错了什么吗?
我相信斜杠是您的模式中的问题。在您的根.htaccess中尝试以下规则:
RewriteCond %{QUERY_STRING} ^main_page=index&cPath=5$ [NC]
RewriteRule ^/?(index\.php)?$ /$1?main_page=index&cPath=25 [NC,L,R=301]
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句