Replace all PHP file extension

By August 15, 2015PHP

Replace all PHP file extension with html using .htacess PHP

To replace the PHP file extension to .html extension from your project files like if you have www.crazyeducation.in/index.php and you what to change it to www.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

Experienced Software Engineer with a demonstrated history of working in the marketing and advertising industry. Skilled in SQL, Web Applications, PHP, WordPress, and Joomla. Strong engineering professional with a B-TECH focused in Information Technology from JCDM College of Engineering Sirsa, Haryana.

More posts by Pankaj Singh Sugara