Menu

Remove PHP Extension from URL Using Htaccess URL Rewrite Rule

Home, PHP By Jun 11, 2016 No Comments

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.

 

Author

Hello i am Vivek Moyal PHP developer and writes tutorials for students and beginners. Love to explore new cities

No Comments

Leave a comment

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