1

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 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]

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

Here's how I do it.

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

That sends pretty much everything to the index file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.