[英]redirect url already rewritten in htaccess
我已经写了htaccess我的实际网址是
https://www.example.com/index.php?route=information/partnership_form
改写为
https://www.example.com/for-brands/partner-with-us
就像我写的规则一样
`RewriteRule ^for-brands/partner-with-us$ https://www.example.com/index.php?route=information/partnership_form [NC,L]`
但是如果某些用户访问了https://www.example.com/index.php?route=information/partnership_form,我想重定向
至
https://www.example.com/for-brands/partner-with-us
下面是我的代码重定向,但我尝试了许多其他方法来形成stackoverflow的其他链接,但仍找不到任何解决方案
rewriterule ^index\.php?route=information\/partnership_form(.*)$ /for-sports-brands/partner-with-us$1 [r=301,nc]
您不能像这样操纵查询字符串。 您需要使用RewriteCond
RewriteEngine on
RewriteCond %{QUERY_STRING} ^route=information/partnership_form [NC]
RewriteRule ^index\.php$ /for-brands/partner-with-us? [NC,L,R]
? 重写目标的末尾很重要,因为它会丢弃旧的查询字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.