gpt4 book ai didi

apache - 301 将所有页面重定向到新站点,除了 1 个目录

转载 作者:行者123 更新时间:2023-12-04 01:44:43 26 4
gpt4 key购买 nike

我试图为所有页面创建一个 301 重定向,但一个目录到一个新站点,但我在设置它时遇到了麻烦。

这基本上是我需要的:

http://www.example.com/store => no redirects, users remain on http://www.example.com/store
http://www.example.com/* => all other pages go to this url http://www.newdomain.com/

AKA

http://www.example.com/apple => http://www.newdomain.com/
http://www.example.com/pie => http://www.newdomain.com/
http://www.example.com/foo/bar => http://www.newdomain.com/

我试过这个方法:
RewriteEngine on
RewriteCond %{REQUEST_URI}!^/store/
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

但是当我去 http://www.example.com/store它带我到 http://www.newdomain.com/store

基本上我需要目录/store 保留在旧域上。任何人都可以帮忙吗?没有经历过 .htaccess 规则......

最佳答案

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/store
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

关于apache - 301 将所有页面重定向到新站点,除了 1 个目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16728812/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com