Posted in: Home, PHP

Remove PHP Extension from URL Using Htaccess URL Rewrite Rule

Hello friends many times we need to remove the extensions from our URL for better SEO. So in this tutorial we will tell you how you can Remove PHP Extension from URL using  .htaccess file.

Use the below code in your .htaccess file only

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

In this above code we have used the Rewrite Rule and removed the .php extension from all the URL which fulfill the rule.

Hope you like our code if you have any advice or any feedback or any issue regarding the code please let us know we will try to solve it quickly.


Leave a Reply

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