Website Design, Social Media Management and Photography- South England.
Home Services Blog Contact

How to remove .html from your URL

March 2018

If you are creating your site from scratch and not using a CMS (content management system) such as Squarespace to help, you may be wondering how you remove the .html from the end of your URL (for example: www.katiehamling.com/blog.html).This post will show you how to in just 3 easy steps!

Step 1: First, create a new file in your text editor, in my case notepad++ and save it as '.htaccess'. In this file, type the following code:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^([^\.]+)$ $1.html [NC,L]

Step 2: Upload this file to your web server, in the same folder that you've saved 'index.html' in

Step 3: Finally, you need to make sure all the links in your site are how you want them to appear, for example change the a href="contact.html" links to just a href="contact" and so on!

NOTE:

When you save the .htaccess file, make sure it stays named that and doesn't add .txt or .html on the end!