2013-12-19 203 views
0
RewriteEngine on 
Redirect 301 includes/config.php http:/mydomain.com/includes/index.php 
Redirect 301 includes/blog_inc.php http://mydomain.com/includes/index.php 

問題是隻有第一個重定向在工作,這是針對配置文件的。我有多個文件重定向到index.php這個包含文件夾。我能做些什麼來將所有請求重定向到includesincludes/index.php?我已經把這個.htaccess文件放在根目錄下。HTACCESS文件無法正常工作

回答

0

使用RedirectMatch爲正則表達式使用:

RedirectMatch 301 ^/includes/(?!index\.php).+$ /includes/index.php 
+0

我應該把它放在根目錄或文件夾包含? –

+0

它也給出錯誤,該頁面沒有正確重定向。我把它放在根目錄中... –

+0

是的,它需要在根目錄下,我修復了導致循環的代碼。現在就試試。 – anubhava