2013-05-24 14 views
11

すべてのページに対して301リダイレクトを作成しようとしていますが、新しいサイトに1つのディレクトリを作成しようとしていますが、設定に問題があります。301すべてのページを新しいサイトにリダイレクトする1ディレクトリ以外

これは私が必要なもの基本的に次のとおりです。

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の規則で経験していない...

答えて

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

古典的な場合のある場合のケース。ありがとう! – Tom

関連する問題