2011-06-22 23 views
0
RewriteCond %{HTTP_HOST} ^mysite.com$ 
RewriteCond %{REQUEST_URI} ^/ex-ex[/]* 
RewriteRule ^(.*)$ /subsite/ex [R=permanent,L,NE] 

我重定向mysite.com/ex-ex重寫條件mysite.com/subsite/ex在htaccess文件

這是工作正常,但mysite.com/ex-ex/page1重定向到mysite.com/subsite/ex。我如何重定向到mysite.com/subsite/ex/page1

我如何將url的其餘部分追加到新的url模式?

回答

1

這將做到這一點:

RewriteCond %{HTTP_HOST} ^mysite.com$ 
RewriteRule ^/ex-ex(.*)$ /subsite/ex$1 [R=permanent,L,NE] 

編輯:在規則增加了一個斜線

+0

它不是這個規則是不是在所有 – GoodSp33d

+0

重定向我錯過了一個斜線從重寫規則的工作,但它應該工作。 – aorcsik

+0

我也試過這個也沒有重定向:( – GoodSp33d