[英]How do I 301 redirect specific pages to remove part of the URL?
每个以以下开头的 URL:
https://example.com/usa/example-1/
我想重定向到example-1
更改为example-2
的 URL:
https://example.com/usa/example-2/
例如,这个网址:
https://example.com/usa/example-1/state/city/
重定向到:
https://example.com/usa/example-2/state/city/
等等。
你能帮我吗? 我总是很难使用.htaccess
所以我更喜欢在测试前询问。
在.htaccess
文件的顶部尝试类似以下内容:
RewriteRule ^(usa)/example-1/(.*) /$1/example-2/$2 [R=301,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.