2012-03-15 60 views
0

我遇到了一個問題重定向一些舊網址到新的位置的.htaccess重定向和路徑

參與的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)會導致seip和第三個url(2和3)被重定向到1)重定向(即http://domain.com/somecategory/newurl-for-this-page.html

我想說明d爲什麼第二和第三位跟隨第一條指令?

臨時解決方案是放棄第一次重定向。所以,當一個cleint要求舊的URL 1日,他們將獲得404錯誤

有過的.htaccess來解決這個問題的方法嗎?

這是怎麼發生的?

什麼是具有3個網址具有相同路徑

oneword-THIS-PATH.html

twoword-THIS-PATH.html

thrreword結束的邏輯-THIS-PATH.html

正在從相同的.htaccess文件重定向?

謝謝你

回答

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] 
+0

我得到一個404錯誤,也許我錯過了在服務器的一些MOD? – IberoMedia 2012-03-16 18:27:01