301 重定向重定向不是指定的 link
301 redirects redirecting not the specified link
想要将一些链接从旧站点重定向到新站点并这样做:
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。
也许是因为 slug /our-people
和 /our-differiantiators
以及 wordpress 以某种方式处理它?
尝试写入:Redirect 301 /benefits http://newsite.com/our-differiantiators/
在文件末尾;
或者您可以将第一行更改为:
RedirectMatch ^/benefits$ http://newsite.com/our-differiantiators/
更改此行:
Redirect 301 /benefits http://newsite.com/our-differiantiators/
通过这个 :
RedirectMatch 301 /benefits/$ http://newsite.com/our-differiantiators/
使用 RedirectMatch
你将只匹配 benefits/
,以斜线结尾,单独出现时目录,否则其他规则将起作用
想要将一些链接从旧站点重定向到新站点并这样做:
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。
也许是因为 slug /our-people
和 /our-differiantiators
以及 wordpress 以某种方式处理它?
尝试写入:Redirect 301 /benefits http://newsite.com/our-differiantiators/
在文件末尾;
或者您可以将第一行更改为:
RedirectMatch ^/benefits$ http://newsite.com/our-differiantiators/
更改此行:
Redirect 301 /benefits http://newsite.com/our-differiantiators/
通过这个 :
RedirectMatch 301 /benefits/$ http://newsite.com/our-differiantiators/
使用 RedirectMatch
你将只匹配 benefits/
,以斜线结尾,单独出现时目录,否则其他规则将起作用