以外のすべての子ディレクトリをリダイレクト:Apacheは、私は次のURLを持っているので、1
www.example.com/parent/child1
www.example.com/parent/child2
www.example.com/parent/child3
www.example.com/parent/cool-feature
www.example.com/parent/product
etc...
私は新しいドメインにchild2
以外のすべての子供たちをリダイレクトする必要があります。最後のスラッシュに
www.example.com/parent/child2/
:
ためwww.example.com/parent/child2
ではなく:これは、のために働いている
RedirectMatch ^/parent(?!/child2) http://www.new-example.com/parent/
:
これまでのところ、私は出ています
無駄に、私が試してみました:意図したとおりに
RedirectMatch ^/parent(?!/child2/) http://www.new-example.com/parent/
RedirectMatch ^/parent(?!/child2\/) http://www.new-example.com/parent/
RedirectMatch ^/parent(?!/child2)/ http://www.new-example.com/parent/
RedirectMatch ^/parent/(?!child2)/ http://www.new-example.com/parent/
も' /親/ child2の/ '私は@DusanBajicに同意 –
にリダイレクトされます、あなたの最初の' RedirectMatch'ディレクティブは私のために[OK]を動作するように表示されます。おそらく矛盾している他の指示がありますか? 'child1'、' child2'などのディレクトリ、ファイル、またはURLは、フロントコントローラにマッピングされていますか?私は後で推測するので、あなたはおそらく既存のmod_rewrite指令を持っていますか?また、間違った301がキャッシュされている場合に備えて、ブラウザのキャッシュをクリアしてください。 – DocRoot
@DusanBajicはい、それは私が求めるものです。残念ながら '/ parent/child2 /'はリダイレクトしています。私はリダイレクトしたくありません。 – MonkeyZeus