301将所有页面重定向到新站点除1个目录外

Tom*_*Tom 11 apache .htaccess http-redirect

我试图为所有页面创建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/
Run Code Online (Sandbox Code Playgroud)

我试过这个方法:

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

但是当我访问http://www.example.com/store时,它会转到http://www.newdomain.com/store

基本上我需要目录/存储保留在旧域上.有人可以帮忙吗?不熟悉.htaccess规则......

cla*_*fob 20

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