Go Back   HostGator Peer Support Forums > Public Forums > Pre-Sales Questions

Notices

Reply
 
Thread Tools
  #1  
Old 10-09-2007, 09:49 PM
PardonGranted.ca
HostGator Guest
 
Posts: n/a
Default hide .html extension with .htaccess

Hi,

I am currently a client and have been trying figure out how to hide my .html extensions in the web browser.

I came across a .htaccess file, uploaded to the public_html folder and it still doesn't work. Does anyone know what I'm doing wrong?


RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

Your help is very much appreciated.
Reply With Quote
  #2  
Old 10-09-2007, 11:42 PM
slapshotw's Avatar
slapshotw slapshotw is offline
Veteran Croc
 
Join Date: Jun 2006
Posts: 5,163
Default Re: hide .html extension with .htaccess

I'd definitely do this by forcing a file type instead of using a regex rewrite. Would something like this work:

Code:
<Location /htmlfiles>
ForceType text/html
</Location>
That's if you only want to do it in one directory. Leave off the location lines to make it everywhere. Or you can do this:

Code:
ForceType text/html

    <Location /css>
      ForceType text/css
    </Location>

    <Location /includes>
      ForceType application/x-httpd-php
    </Location>
That will make the default value html, except for certain directories where you have other types of files. Also do it for an image directory.
__________________
Follow me on Twitter! http://twitter.com/mrw
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 03:47 PM.

 
Forum SEO by Zoints