开发者

.htaccess redirect request not index.php

I have a setup like this http://www.example.com/reroute/index.php. I would like to send all request not to index.php to index.php. So anything to /reroute/products would go to /reroute/index.php and would display 开发者_StackOverflow社区http://www.example.com/reroute to the browser. It seems simple enough but every thing I have tried either tells me file doesn't exist or sends me in a loop.

Also, is it possible to set custom headers before I reroute?

Options +FollowSymLinks
IndexIgnore */*

# Turn on the RewriteEngine
RewriteEngine On

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


Try this rule:

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

This will rewrite all requests not requesting index.php to index.php within the same directory.


Here's how I do it.

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

That sends pretty much everything to the index file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜