How to Remove .html in Joomla's URLs

One Joomlashack University student was wondering how to remove the .html at the end of his URLs.

This tutorial will show you how to do that and provide a useful SEO tip.

Why would you remove .html?

Before Content Management Systems were around, there was HTML. Almost all web pages on the web had ".html" behind them.

When Joomla came around, it needed a way to provide backward compatibility with what search engines and users expected. So it added the feature to add ".html" at the end of the URL.

How to turn off the .html suffix

  • Go to the Joomla administrator area
  • Go to System -> Global Configuration (top menu)
  • Click the "Site" tab
  • Set the "Adds Suffix to URL" option to "No"
  • Click "Save & Close" 
How to Remove .html in Joomla's URLs

After turning it off, go to your home page, refresh the page, and make sure links work.

Important SEO Tip

With this change, you've modified practically all the URLs for your site. So any old links would likely result in 404s.

To fix this, edit your .htaccess file and add the following code after "RewriteEngine On":

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} \.html$
RewriteRule ^(.*)\.html$ /$1 [R,L]

For users on NGINX server

To enable Search Friendly URLs on NGINX server, please add the following code to your server nginx.conf configuration file:

location / { try_files $uri $uri/ /index.php?$args; }

If this code doesn't workour, try:

server { 
 .... location / { expires 1d; 
 # Enable joomla SEF URL's inside Nginx 
 try_files $uri $uri/ /index.php?$args; 

Be sure to test any old links to make sure they redirect properly. Or add .html after new links and see if they redirect to the non-html URL version.

About the author

Nick is the Director of Support at Joomlashack and you can find him in almost every area of the site, from answering support requests and account questions to creating tutorials and software.