[英].htaccess 301 permanent redirect rule
我现在有这个网址结构。
http://example.com/weather/in-city_name
我想永久重定向到
http://example.com/city_name/weather
这是我使用此引用写入.htaccess文件的内容
RedirectMatch ^/weather/(.*)$ http://example.com/$1/weather
但这是行不通的。
在我的条件下city_name
是动态的,无法手动输入。
关于如何实现期望结果的任何建议都是很好的。
您可以使用以下.htaccess
:
RewriteEngine on
RewriteRule ^weather/in-(.+)/?$ /$1/weather [R=301,NC,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.