Removing file extensions from display via htaccess.

Removing this file extensions helps with SEO, and others believe it is better for security.

The steps to remove file extensions are:

  • Login to your cPanel account.
  • Go to Files category and click on the File Manager.
  • In the File Manager at the top right hand corner,go to the Settings button.
  • Check the Show Hidden Files option and make sure that it's checked. Click Save button to apply the settings.
  • Look for the .htaccess file and right click on it and If the file doesn’t exist you will need to create it.This brings up a menu. Find and click on the Edit option.
  • Click the Edit button from the File Manager top menu.
  • Add the below lines to the .htaccess file.
  • 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]
  • Click the save changes button in the upper right conner to save your new .htaccess configuration and then close
  • Now the Apache web server will remove .html extension from URLs.