Sunday, December 19, 2010

Today I finally after years of searching (sort of) found out how to remove the .html or .php at the end of a url. Its not very important but its easier to remember urls and it makes you site look more professional.

Solution 

The solution is to use you .htaccess file so if you are using a free host leave now. 

Here is the htaccess code.

Make a new text document and save it as ".htaccess". make sure nothing is in front of the ".".

paste the following code in the document. 

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

And you should be good to go.