Remove .html extensions with .htaccess

When you create a simple website with HTML, or PHP you will want to have user-friendly URLs on your site. Instead of you will want to have

Follow the below guide to achieve this by simply editing the .htaccess file in your Apache Server.


  • Go to File Manager – in the FILES Section
  • In the File Manager go to the Settings button on the top right corner.
  • On the Preferences window that will appear check the Show Hidden Files (dotfiles) option. Click Save button to apply the settings.
  • Now navigate to the .htaccess file. If the file doesn’t exist you will need to create it.
  • Click the Edit button from the File Manager top menu.
  • Add the below lines to the .htaccess file. Click the Save Changes button and then the Close button.
#remove html file extension-e.g. will become
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [NC,L]

Alternatively you can use an FTP file manager like FileZilla to achieve this, which I prefer than the method above.

Notice that many PHP scripts (like WordPress, Drupal, MediaWiki etc) need the .htaccess files to function properly. Don’t delete these files. Also take care when editing them.

PS – Depending on your hosting provider this might not work straight away. In such cases, edit href(s) in your code from href=”about.html” to href=”about” (take off the extention at the end)


Leave your thoughts

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

%d bloggers like this: