2016-10-03 46 views
1

我想要將包含?_escaped_fragment_ =的URL重定向到另一個端口。舉一個例子,htaccess從一個端口重定向到另一個

http://localhost:8080/web/?_escaped_fragment_=/privacy 

http://localhost:8082/web/?_escaped_fragment_=/privacy 

我當前htaccess的是如下。

RewriteEngine On 
RewriteCond %{REQUEST_URI} ^/$ 
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.*)$ 
RewriteRule ^(.*)$ http://dev.dermveda.com:8082/$1 [r=301,nc] 

的問題是,如果URL中包含web/,它不重定向到我新的端口。但如果它沒有web/它重定向罰款。 例如 像http://localhost:8080/web/?_escaped_fragment_=/privacy這樣的網址沒有重定向。但是像http://localhost:8080/?_escaped_fragment_=/privacy這樣的URL會被重定向。我的問題是,我應該如何實現htaccess將web/的URL重定向到另一個端口。

回答

0

問題是這種情況的存在:

RewriteCond %{REQUEST_URI} ^/$ 

這種情況的手段只有重定向如果您的網址是/,這意味着唯一的到達比賽。

只是刪除這一條件,有你的規則爲:

RewriteEngine On 

RewriteCond %{QUERY_STRING} ^_escaped_fragment_= [NC] 
RewriteRule^http://dev.dermveda.com:8082%{REQUEST_URI} [R=301,L,NE] 
相關問題