2010-01-05 232 views
1

我有这样的设置http://www.example.com/reroute/index.php。 我想发送所有请求不要index.phpindex.php。因此,任何到/reroute /产品将去/reroute/index.php和将显示http://www.example.com/reroute到浏览器。它似乎很简单,但我试过的每件事都告诉我文件不存在或发送给我一个循环。.htaccess重定向请求不index.php

另外,是否可以在我重新路由之前设置自定义标题?

Options +FollowSymLinks 
IndexIgnore */* 

# Turn on the RewriteEngine 
RewriteEngine On 

RewriteCond %{IS_SUBREQ} false 
RewriteRule ^/index\.php$ http://www.example.com/reroute [R=301,L] 

回答

1

试试这个规则:

RewriteRule !^index\.php$ index.php [L] 

这将改写所有的请求没有请求的index.php的index.php同一目录下。

0

以下是我的工作方式。

RewriteRule ^/reroute/products/$ reroute/index.html [QSA,L] 

这几乎把所有东西都发送到索引文件。

相关问题