If you are not familiar with htaccess, you are missing out. It is one of the greatest things about linux/php hosting. One little file that gives you a wide range of control. Here is one of the most useful parts of htaccess:
Redirecting Many Pages From .html to .php (or “/”) at Once
Today, I am finishing converting a static, HTML website to WordPress. So all 58 pages that used to be /page.html are now /page/ and it would be a pain to go through all of the .html pages and force redirects to their new page. I found this page on Web Weaver that explains this well:
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
In my case, I put most of the pages into a subfolder (and without .php) so my htaccess redirect looks like this (example website for placeholder):
RedirectMatch 301 (.*)\.html$ http://www.websitesinaflash.com/website-services$1/
In this example, the $1 get’s replaced with everything from the (.*) which is everything after the domain name and before the .html.
This post was written by Ashton