Remove File Extension Using .htaccess File


Prev Tutorial Next Tutorial

How to Remove File Extension Using .htaccess File

This is helpful for remove your file extension, suppose you want your URL 'domain.com/index.html' to display as 'domain.com/index' for whatever reason. Some people think it's good for SEO and some think it is better for security.

According to my experience if you remove all extension from your website then Google index pages without file extension. In feature if you want to change your website development language for example you change php to jsp in this case your URL remain same for search engine.

Redirect.php Extension

Remove .php Extension

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

Redirect.htmlExtension

Remove .html Extension

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.html -f 
RewriteRule ^(.*)$ $1.html

Prev Tutorial Next Tutorial

Google Advertisements
Download Projects

Google Adsense Advertisements

Buy 3 Year Old Domain, Tutorialday.com, SeosmoTools.com @$200

Buy This Ad Space @$50 per Month, Ad Size 300X250 Contact on: hitesh.xc@gmail.com WhatsApp no. 8882538826

Yahoo Advertisements