www.webdeveloper.com
Results 1 to 2 of 2

Thread: Is this necessary to be in my .htaccess file?

  1. #1
    Join Date
    Aug 2007
    Location
    New Jersey, US
    Posts
    1,779

    Is this necessary to be in my .htaccess file?

    I have these following lines in my .htaccess file. I don't know if I put them there a long time ago, but I'm sure that they're completely unnecessary (I'm sure that there's security measures against accessing these files anyway).

    I use BlueHost hosting and they have a master .htaccess file that I'd imagine protects me from most major security attacks. Here is my file that sits in my root directory:

    Code:
    <Files .htaccess>
    order allow,deny
    deny from all
    </Files>
    <Files error_log>
    order allow,deny
    deny from all
    </Files>
    <Files error_log.txt>
    order allow,deny
    deny from all
    </Files>
    
    RewriteEngine on
    
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
    
    //a few 301 redirects
    
    ErrorDocument 400 http://www.domain.com/400.php
    ErrorDocument 401 http://www.domain.com/401.php
    ErrorDocument 403 http://www.domain.com/403.php
    ErrorDocument 404 http://www.domain.com/404.php
    ErrorDocument 500 http://www.domain.com/500.php
    Are those first several lines necessary? I'd imagine that the error logs and htaccess aren't accessible anyway, correct?

  2. #2
    Join Date
    Jun 2009
    Posts
    127
    It there is this code in your host master .htaccess file then there is no need to put in particular .htaccess file.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles