How to Remove extensions from URL

URL stands for Uniform Resource Locator which is the global address of documents and other resources on the World Wide Web. According to the syntax of URL the first part of the URL is called a protocol identifier and it indicates what protocol to use, and the second part is called a resource name and it specifies the IP address or the domain name where the resource is located. The protocol identifier and the resource name are separated by a colon and two forward slashes.

1) How to remove the.php extension from the URL? #

Ans : Add the following code in .htaccess file
Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^.]+)$ $1.php [NC,L]

2) How to remove the.html extension from the URL ? #

Ans : Add the following code in .htaccess file
Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^.]+)$ $1.html [NC,L]
To host any extension based site you need to have good quality web hosting services to run secure site.

Powered by BetterDocs

Leave a Reply

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

en_USEnglish