HTML image

How to Remove .html from Your URL

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

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!

Buy dedicated serverBitcoin dedicated servers

Posted in Tips and tagged , , , .

29 Responses to How to Remove .html from Your URL

  1. oldans says:

    I love this that was listed. I have been telling a few of my non-tech-savvy friends about this and for the longest time they just thought I was crazy. It takes seconds to complete so anyone can do it, most just don’t know how to!

  2. Jonas Dralle says:

    He spits out this Error:

    You don’t have permission to access / on this server.”

    here the complete content of my .htacess:

    ErrorDocument 404 /404.html
    AddHandler server-parsed .html
    AddDefaultCharset utf-8

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

  3. Justin says:

    I wonder how many people actually struggle with following instructions like this, and how many simply lack the confidence to try, for fear of breaking their website.

  4. Helloworld says:

    Thank you for this info, very useful for SEO TOO!

  5. Kay says:

    mehnnnnn…thanks alot. it worked for me. i had a little challenge cos my site is responsive and detects devices. but i just sticked to d procedure. Its really cool.

  6. Rhys says:

    Doesn’t work for me,
    Have tried multiple versions of this code now… and I get sent to my 404 error page saying The requested URL /www/ was not found on this server (If I remove the .html)

    If I don’t remove it, it says The requested URL /www/ was not found on this server.

    If I remove the .html in the url in the html/navigator, I also get The requested URL /www/ was not found on this server.

    Can’t win?

  7. Rhys says:

    Oh, and if I remove the .html extension in both the files on server, and html in the navigator, the pages load as just the page html, not the actual page….

    • Geeks Hosted says:

      If you are using wordpress please try:

      RewriteEngine On
      RewriteBase /
      RewriteCond %{REQUEST_URI} \.html$
      RewriteRule ^(.*)\.html$ $1 [R=301,L]

      RewriteRule ^index\.php$ – [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]

  8. Sam says:

    Sorry I know this thread is old, but this one actually works! Cheers guys and gurls! Any ideas on how to add a trailing “/” to the end of the url e.g “”

  9. roger says:

    Hi, whenever i try any of those i get 500 internal server error!
    This works

    # Make pages render without their extension

    Options +MultiViews

    I know this gets that same results, eg and if you’re a site visitor why would you want to type in to see if that works
    Just wondering why so ideas work and not others for me?

  10. roger says:

    After another 2 hours of searching i found this one which works, (no trailing slash)

    RewriteEngine On

    # To externally redirect /dir/foo.shtml to /dir/foo
    RewriteCond %{THE_REQUEST} ^GET\s.+\.shtml [NC]
    RewriteRule ^(.+)\.shtml$ /$1 [R=301,L,NC]

    # To internally redirect /dir/foo to /dir/foo.shtml
    RewriteCond %{REQUEST_URI} !\.shtml$ [NC]
    RewriteCond %{REQUEST_FILENAME}.shtml -f
    RewriteRule . %{REQUEST_URI}.shtml [L]

  11. Awesome tip – thanks for this, took me 30 seconds!

  12. Daniel says:


    Is it possible to hide the index for the start site?


    Thank you in advacne!

  13. Thomas Simm says:

    Think it has worked for me.
    But no need to remove the ‘.html’ from my files


  14. CB says:

    Great advice – works perfect!

  15. Anna says:

    I totally can’t get this to work.

    I have a plugin that adds the .html to the end of my urls. I’ve tried using this rule with that plugin activate and de-actived.

    If I type in the .html url it will redirect to the non-.html url I get the “page not found” error.


  16. Nishant Mishra says:

    I did all these but it’s not working.
    Can u please help me and tell what I have to do….

  17. Najish says:

    Tried All Suggestion but not working

  18. Jamie S says:

    Hey thanks so much for this tip! Question though… will adding this script to my .htaccess file mess up any webpages that I leave with .html at the end? I don’t need to switch all my file names over right now, so i wanted to check… Also, my index page has .html at the end, but something must have been done on the server to make it default to no .html at the end – will this update mess that up? Thanks so much!

  19. Yatin Arora says:

    thanks mate the code works

  20. Brett Chila says:

    will this effect SEO? i heard it will

  21. Thank you so much … I was having trouble with this for so long..
    All my links looked like this :- ..

    But now it is all good.. I owe you big time my friend :) ..
    All the best to you .. Cheers!!

  22. hello sir..

    My website url is..…and it have around 40-50 pages and all pages have .html extension..but if i open the any of my webpage without writing .html extension will open the same page for me..and when i created it’s sitemap it will showing me that you have 2 pages of same name..First one is .html and second one is without .HTML..

    like this:-
    So i want only one page without HTML that search engines might index these pages as duplicate what;s is the solution..
    Help me…

  23. Pankaj Patel says:

    It’s work for me. Thanks a lot!!

  24. Caleb Elliott says:

    Well i did that but evertime i would go to the website every page would go to the 404 page

  25. Kya says:

    Hi, does this work on Blogger?

  26. vijayasri says:


    I tried what you said but it says your file is not found. How to do that.

  27. I have tries this and it is working; will display the contents of
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}.html -f
    RewriteRule ^(.+)$ $1.html [L,QSA]

    #301 from to
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/
    RewriteRule ^(.*)\.html$ /$1 [R=301,L]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>