How to hide file extensions from URL using htaccess

Tutorial is about “Hide .html or .php file extensions using .htaccess file”…

Why do you need to hide the file extensions from URL?
According to the SEO Pandits Hiding extension of the files is very useful for SEO prospectus. Google will easily crawl such a simple url where no dot(.) includes..

How to hide extension of the files from URL?
Hiding extension of the files from URL is very simple .. here is a simple tutorial that will guide you step by step…

Step 1: Just open a notepad and save it by name .htaccess

Step 2: Write the given line in this file…

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

Step 3 : Just save the file and upload it to root of your website.

Step 4 : Now just change the linking in all pages …

Example : You have linked your html or php pages like services.html or service.php…
Now you just need to remove .html or .php from the linked files… It should be very plain file name …

That’s it !!!

If you still have any question related to the above article or you have any issue when hiding file extension … You can write to me in comment section….

Leave a Reply

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

2 × 2 =