We do support Round the Clock 24 x 7 x 365 (+91) 883 012 3924

Remove .php extension with the help of .htaccess file

Remove .php extension with the help of .htaccess file

If you want user-friendly URLs on your site and hide .php extension then this post is useful for you.

Please follow below steps to hide .php file extensions :
# Open .htaccess file and add below rewrite rules

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

Now your server will remove .php file extension from all URLs
For example, http://example.com/file.php will become as http://example.com/file

Please also check https://www.l3webhosting.com/blog/remove-html-extension-with-the-help-of-htaccess-file/


Leave a Reply

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