2010-01-05 48 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] 

這幾乎把所有東西都發送到索引文件。

相關問題