2013-12-19 205 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