.htaccess - lose the file .html extension
Posted
by
Darren Sweeney
on Pro Webmasters
See other posts from Pro Webmasters
or by Darren Sweeney
Published on 2012-03-30T12:37:33Z
Indexed on
2012/04/01
5:39 UTC
Read the original article
Hit count: 361
htaccess
|mod-rewrite
I'm having a bad .htaccess day!
I want a user to be able to type the URL
mysite.com/about
instead of
mysite.com/about.html
On .htaccess file I have:
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^/(.*)$ /$1.html [NC,L]
But this simply does not work?
I will add though that if i try this further inside the site e.g.
mysite.com/pages/contact
Works perfectly whether I have the above code in the .htaccess or not
What am I doing wrong?
© Pro Webmasters or respective owner