I am having some trouble hiding the .html
extensions on my website.
I am running on WampServer with Apache V.2.2.22.
rewrite_module
is active and i have changed the httpd.conf
file to have AllowOverride all
This is the only htaccess file that i know of and this is all it contains...
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R=301,L,NC]
</IfModule>
Its not working and i don't know why... here is my httpd.conf
file
DocumentRoot "c:/wamp/www/"
<Directory />
Options FollowSymLinks
AllowOverride all
Order deny,allow
Deny from all
</Directory>
<Directory "c:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride all
# onlineoffline tag - don't remove
Order Allow,Deny
Allow from all
</Directory>
and this is where i have placed the .htaccess
file...
E:\wamp\www\DesktopVersion\.htaccess
Any suggestions as to why this is not working would be great!
EDIT: Just to clarify This is the correct .htaccess code to use... Complement of 'anubhava'
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.html [NC]
RewriteRule ^ %1 [R=301,L]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^ %{REQUEST_URI}.html [L]
</IfModule>