想要将某些链接从旧网站重定向到新网站,并按以下方式执行操作:
Redirect 301 /benefits http://newsite.com/our-differiantiators/
Redirect 301 /benefits/our-people http://newsite.com/about-us/
Redirect 301 /benefits/our-places http://newsite.com/infrastucture/
Redirect 301 /benefits/our-platforms http://newsite.com/infrastucture/
Redirect 301 /benefits/our-experience http://newsite.com/
Redirect 301 /benefits/our-testimonials http://newsite.com/
但如果我尝试转到我的newsite.com/benefits/our-people
,它会重定向到newsite.com/our-differiantiators/our-people
而不是newsite.com/about-us
我应该如何修复我的.htaccess代码以重定向?
P.S。
也许是因为slu /our-people
和/our-differiantiators
以及wordpress在某种程度上正在处理它?</ p>
答案 0 :(得分:3)
更改此行:
Redirect 301 /benefits http://newsite.com/our-differiantiators/
由此:
RedirectMatch 301 /benefits/$ http://newsite.com/our-differiantiators/
使用RedirectMatch
,您将只匹配benefits/
,以斜杠结束,目录单独使用,否则其他规则将起作用
答案 1 :(得分:2)
尝试在文件末尾写下Redirect 301 /benefits http://newsite.com/our-differiantiators/
;
或者您可以更改第一行:
RedirectMatch ^/benefits$ http://newsite.com/our-differiantiators/