IndianWebPortal.com

Something Different In Linux

Home » htaccess » Remove extensions from url

Remove extensions from url

Posted by Rishikesh Vispute Categories: htaccess, Knowledge

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]

======================

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]

======================

One Response so far.

  1. Great post! I started following your blog about a month ago and I like your honesty. Good example to emulate.


Popular Posts

remove index.php fro

How to remove index.php from url in magento Ans : If you ...

PHP-Java bridge on p

  What is php-java bridge? The php-java bridge is the php ...

Set expiration for y

If you want to set the expiration to your site ...

Warning: Parameter 1

Error: Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a ...

domain pointing to e

If you domain uses external MX record and it is ...