2013-03-28 52 views
1

我需要的是如果任何人會擊中mydomain.com/mydirectory/about-us-new,那麼它應該停留在頁面上,如果任何人在同一個域上擊中任何其他網址,它應該重定向用戶轉到google.com。無法重定向.htaccess規則

我使用下面的代碼用於此目的:

#urls to exclude 
RewriteCond %{REQUEST_URI} !^/mydirectory/about-us-new$ 

#send to root 
RewriteRule . http://google.com? [R=302,L] 
+0

你的代碼看起來很好,只要有這樣的RewriteRule:'RewriteRule^http://google.com? [R = 301,L]' – anubhava

回答

0

試圖逃避改寫條件

RewriteCond %{REQUEST_URI} !^/mydirectory/about\-us\-new$ 
0

你上面提供適用於我重寫代碼。

如果安裝了mod_rewrite,您可以嘗試確保RewriteEngine已啓用。

<IfModule mod_rewrite.c> 
    RewriteEngine on 

    RewriteCond %{REQUEST_URI} !^/some/url/here$ 
    RewriteRule . http://www.google.com? [R=302,L] 
</IfModule>