0

古い URL を新しい場所にリダイレクトする際に問題が発生しました

問題には、次のような URL が含まれていました。

1) RedirectMatch permanent  THISWORD-THIS-WORD.html http://domain.com/somecategory/newurl-for-this-page.html

2) RedirectMatch permanent someurl-THISWORD-THIS-WORD.html http://domain.com    

3) RedirectMatch permanent anotherurl-THISWORD-THIS-WORD.html http://domain.com/new-anotherurl.html

問題は次のとおりです。

最初の URL (1) をリダイレクトすると、2 番目と 3 番目の URL (2 と 3) が 1) リダイレクト (つまり、http://domain.com/somecategory/newurl-for-this-page.html )にリダイレクトされます。

2 番目と 3 番目が 1 番目のディレクティブに従った理由を理解したいのですが?

暫定的な解決策は、最初のリダイレクトを放棄することでした。そのため、cleint が古い URL 1 を要求すると、404 エラーが発生します。

.htaccess でこれを解決する方法はありますか?

なぜこうなった?

同じパスで終わる 3 つの URL を持つロジックは何ですか?

すなわち

oneword-THIS-PATH.html

twoword-THIS-PATH.html

thrreword-THIS-PATH.html

同じ .htaccess ファイルからリダイレクトされていますか?

ありがとうございました

4

1 に答える 1

0

RedirectMatch は使用しません。

これを試して

RewriteCond %{REQUEST_URI} ^.*/THISWORD-THIS-WORD.html
RewriteRule ^http://domain.com/somecategory/newurl-for-this-page.html [R=301,L]

RewriteCond %{REQUEST_URI} ^.*/someurl-THISWORD-THIS-WORD.html
RewriteRule ^http://domain.com [R=301,L]

RewriteCond %{REQUEST_URI} ^.*/anotherurl-THISWORD-THIS-WORD.html
RewriteRule ^http://domain.com/new-anotherurl.html [R=301,L]
于 2012-03-16T00:28:17.060 に答える