Sunday, February 25, 2018

Removing file extensions php/html from URL using htaccess

Open your .htaccess file using text Editor option. Then place this code

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php

RewriteCond %{REQUEST_FILENAME}\.html -f 
RewriteRule ^(.*)$ $1.html

Now Save the file. Now you'll see extension are gone from URL.

Total Pageviews