.htaccess redirect guidePosted: July 26, 2008 | Author: tech0x20 | Filed under: web development | Leave a comment »
My favorite tip:
Changed file extension?
This example is perfect if you’ve decided to switch to .php from .html pages. It will look for any .html page and redirect it to .php (ie http://www.example.com/yourpage.html and redirect it to http://www.example.com/yourpage.php). Now, be careful with this, it does mean any html page. I did this on one of my sites and had totally forgotten I had an iframe with .html content on some pages… I didn’t notice for weeks that it was broken :S.
So learn from my mistake 😉 check, double check, then check again.RedirectMatch 301 (.*).html$ http://www.example.com$1.php