.htaccess

How to Remove .html from Your URL

October 9, 2013 in Tips by Geeks Hosted  |  29 Comments
HTML image

It’s 2013 and there’s no reason to have .html showing on the end of each URL on your website. There’s a simple solution to remove .html from your website to come across more professional.

You need to create an .htaccess file. In order to do that, open Notepad on your computer. In Notepad, input the following:

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

In order to save the file, go to File > Save As. For the file name, call it “.htaccess” without the quotes. Change the Save As Type to “All Files.”

Once you have the file saved, upload it to your public_html folder on the server. The last thing you’ll have to do is remove .html from all of your file names.

If you have any questions or comments, please feel free to post below!