Hide Remove .php extension with URL rewriting using htaccess in PHP

How to show php file without its extension inside address bar.

Extension is very important part for any files because extensions can separate hundreds of files format and every single file format has its own extension. For example .php , .html , .css, .js etc. If we remove the .php extension from file URL then it can be load without typing or calling .php extension after file name on internet. This can be done using .htaccess file . With the use of URL rewriting method web developers can rewrite the web page file URL using .htaccess file so here is no need to specify file extension while typing whole file URL inside address bar. So here is the complete step by step tutorial for Hide Remove .php extension with URL rewriting using htaccess in PHP.

Hide Remove .php extension with URL rewriting using htaccess in PHP

How to Hide Remove .php extension with URL rewriting using htaccess in PHP.

Note : Put this .htaccess file into your main folder and it will automatically rewrite the php web pages URL’s .
Code for .htaccess file.

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

 

Leave a Reply

Your email address will not be published. Required fields are marked *