Remove File Extension Using .htaccess File

Advertisements

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 Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements