How to remove the .php/.html extensions from the website URL?

Started by Dipak Bhoi, May 19, 2015, 12:58:44 PM

Previous topic - Next topic

Dipak Bhoi

Hello folks,

Website URLs looks unprofessional when they comes with extensions like .php/.html. You can remove these extensions using a below lines of code in .htaccess file.

For .php extension :

QuoteOptions +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]

For .html extension :

QuoteOptions +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.html [NC,L]

That's all.

Hope this post help you. Enjoy !! :) :)


MilesWeb - 30-Day Money Back
cPanel Web Hosting - cPanel Hosting in India
Grab a Free SSL for your website.  WordPress Optimized Solution.