Archives

All posts for the month April, 2016

How to remove .html from URL

Published April 7, 2016 by Anil Kumar Vishwakarma

To remove the .html extension from your urls, you can use the following code in root/htaccess :

RewriteEngine on
RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ /%1 [NC,L,R]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [NC,L]

Advertisements