Sometimes you need to redirect some URL and/or page on your site to another one. The feature is very useful if you have recently redesigned your site but you wish to keep the old addresses working for various reasons (you have links to these pages from other sites, some users may have the old pages bookmarked, etc).
The Apache web server provides several way for setting up redirects.
The most simple one is using the “Redirect” directive:
Recently it has been talked a lot about Permanent redirects. The good news is that you can add a status code to the Redirect directive. For example for Permanent 301 redirect you can use:
This will redirect all requests to files that end with .html to the index.php file.
There is another more powerful way to create redirects or even create transperant redirects which requires ModRewrite. We will talk about this in the next article.