2012-03-15 91 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