Replace all php extension with html using .htacess PHP

By August 15, 2015PHP

Replace .php extension to .html extension

To replace the .php extention to .html exyension from your project files like if you have http://crazyeducation.in/index.php and you what to change it to http://crazyeducation.in/index.html you have to create .htaccess file and add the following code inside it.


Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [nc]

Remove .php extension

To remove the .php extention form your project file like :
Initial url : http://crazyeducation.in/about.php
Required Url : http://crazyeducation.in/about
add the following code in your .htaccess file


Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

Remove .html extension

To remove the .php extention form your project file like :
Initial url : http://crazyeducation.in/about.html
Required Url : http://crazyeducation.in/about
add the following code in your .htaccess file


Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

Pankaj Singh Sugara

Author Pankaj Singh Sugara

More posts by Pankaj Singh Sugara