Loading...

Remove .php Extention from URL with htaccess

Today I will share about how to remove .php extention from url. But, before that,let me explain why you must remove the .php extention from your url. The main reason is to make search engine to be easy to collect your data from your website.
That mean, your website more readable from seach engine and user friendly. Because, in the SEO, website which is have readable url have more benefit to selling product on the website.

So, let's start. First , make your .htaccess file and simply copy code below into your .htaccess.

<IfModule mod_rewrite.c>

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

</IfModule>

Place your .htaccess into the main root directory. Then try to make a file call test.php & go.php

inside of test.php , just put 

<a href="go">[ to go ]</a>

then inside of go.php, just put Done!

 

Then now, access your file. example http://localhost/test/test

Now the .php extention already removed.

If you have a problem to implement it, just leave a comment. Thank you.

SHARE NOW
Share

Leave a comment

Get the latest update about web development.