MilesWeb Hosting Forum

Web Hosting Technical Support => How To's => Topic started by: Dipak Bhoi on May 19, 2015, 12:58:44 PM

Title: How to remove the .php/.html extensions from the website URL?
Post by: Dipak Bhoi on May 19, 2015, 12:58:44 PM
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 !! :) :)