If you want your website to have friendly URLs you can use this .htaccess code. With this example code, the URL
http://example.com/about would cause the page about.htm to load.
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_FILENAME}\.htm -f
RewriteRule ^(.*)$ $1.htm [L]
With the above example, if there is no dot in the requested name (this prevents executing the filename lookup logic for every file request), and the request matches a filename (with a .htm on the end), it will take the request and put .htm on the end.
There are two restrictions with this method. Make sure there is not a directory with the same name as the url you are using (if using
http://example.com/about - make sure there is not a directory named about), or you may get undesired results. And the page you wish to load cannot have a dot in the name (i.e. about.me.htm will not work).
Here is a second method. This one does not do a filename check so it is faster, but it could also do a rewrite when there is no file.
RewriteEngine On
RewriteRule ^([^\./]+)$ $1.htm [L]
With the above example, if there is no dot or slash in the requested name, and the request is not empty (meaning the default page), it will take the request and put .htm on the end.
There are also two restrictions with this method. Make sure there is not a directory with the same name as the url you are using (if using
http://example.com/about - make sure there is not a directory named about), or you may get undesired results. And the page you wish to load cannot have a dot or slash in the name (i.e. about.me.htm or sub/about.htm will not work).
You can make any number of variations as to the criteria using these examples as a starting point.
Bookmarks