Remove (.html) or (.php) from Website URL or link
How to Remove (.html) or (.php) from Website URL or link .
Start From Here ( 5 MINS READ TIME )
Add The Below code in .htaccess file to remove (www.abc.com/about.html or www.abc.com/about.php) from URL or Website Easily
Example if your website is opening like this :
"www.abc.com/about.html" or "www.abc.com/about.php"
& you want to remove .html or .php extension from URL & Website then add below code in your site's root .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R=301,L,NE]
After adding your website will look like: (example)
"www.abc.com/about"
Note: This code will also help in redirections if some opens ( "www.abc.com/about.html") by force it will redirect to ("www.abc.com/about") . This will save you from Duplicate Website Content Issues.
Note: Backup your current .htaccess file and then add these rules.