Problem With Solutions

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.


Page optimized by WP Minify WordPress Plugin

Optimized by SEO Ultimate