How to remove .html from URL

I was adding a new events page to the website. When you view the URL (Uniform Resource Locator) it was showing the .html after the page. I didn’t like that. I thought it made us look amateurish. Being a web developer there is always a solution you can find on google and StackOverflow.  Here are step-by-steps instructions.

Access your cPanel for your website

Go to SETTINGS and click on  Show Hidden Files (dotfiles)


Create a new  .htaccess file in your public_html folder. 


Inside your .htaccess file add this.

RewriteEngine on
RewriteBase /
RewriteCond %{} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ [R=301,L]

You will replace on line 3 and 8 with your website.


In your file where you have your index.html or file that has a .html extension change the  link to the name of the file without the .html.

I have an events.html page I want to link on the website.

<a href="">Events</a>


Voila! Your URL no longer has the .html extension.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s