Redirect pages with html suffix

turn-off-html-suffix If you turn off the HTML Suffix in SEO Settings in Joomla, it will break the old links that could be indexed by search engines, bookmarked or linked within your or other websites. This will result in 404 Page not found error, which can be addressed by making a small change in htaccess file to redirect old .html pages to their new URLs without the HTML suffix.

HTML suffix can be turned on or off in Joomla’s Global Configuration settings. It’s located in SEO Settings (see the image above) section under the Site settings tab.

Turn HTML suffix off

Once you turn off the HTML suffix, all URLs on the website will change from domain.com/alias.html to domain.com/alias and you will need to add a redirect from old URLs to new once. This can be done by adding the following rule to .htaccess file

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

Turn HTML suffix off

If you turn the HTML suffix on, the opposite will be true. All URLs on the website will change from domain.com/alias to domain.com/alias.html and you will need to add a different redirect rule .htaccess file:

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

 

Would you like to contribute?



Free business joomla templates