Problems with htaccess protection

Discussion in 'PHP' started by adamjblakey, Apr 22, 2008.

  1. #1
    Hi,

    I have a folder on my server which i want to protect. I though everything is setup fine and does protect the folder but also protects the public_html also even though the htaccess file is in a sub folder.

    
    AuthName "Restricted Area" 
    AuthType Basic 
    AuthUserFile /vhost/vhost6/s/d/o/.htpasswd 
    AuthGroupFile /dev/null 
    require valid-user
    
    Code (markup):
    Any ideas?

    Cheers,
    Adam
     
    adamjblakey, Apr 22, 2008 IP
  2. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Make sure there is no .htaccess in public_html folder.
     
    mwasif, Apr 22, 2008 IP
  3. itcn

    itcn Well-Known Member

    Messages:
    795
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    118
    #3
    Look in the <Directory> section of your httpd.conf file for apache and make sure it is properly configured.
     
    itcn, Apr 22, 2008 IP
  4. adamjblakey

    adamjblakey Active Member

    Messages:
    1,121
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    80
    #4
    There is no .htaccess file in the public_html folder and i cannot look at the httpd.conf file either because i don't have access to this.

    Any other ideas?
     
    adamjblakey, Apr 28, 2008 IP
  5. itcn

    itcn Well-Known Member

    Messages:
    795
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    118
    #5
    Then maybe you are on a shared host which doesn't allow protection of subfolders. If you don't have access to editing the httpd.conf file there's not much you can do.
     
    itcn, Apr 28, 2008 IP
  6. adamjblakey

    adamjblakey Active Member

    Messages:
    1,121
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    80
    #6
    Right i think i have found the problem, basically within the folder i am protecting i have a folder with images which i am accessing to display images on the main site. I think because it is protecting the folder and it's sub folders that is where the problem lies.

    Is it possible to add another .htaccess to the images folder to reverse the rule on that sub folder?
     
    adamjblakey, May 6, 2008 IP
  7. wmtips

    wmtips Well-Known Member

    Messages:
    601
    Likes Received:
    70
    Best Answers:
    1
    Trophy Points:
    150
  8. adamjblakey

    adamjblakey Active Member

    Messages:
    1,121
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    80
    #8
    Thank you for that link, it seems a bit complex and also there is no working solution on there.

    Has anyone got a working solution which i can implement?
     
    adamjblakey, May 7, 2008 IP
  9. wmtips

    wmtips Well-Known Member

    Messages:
    601
    Likes Received:
    70
    Best Answers:
    1
    Trophy Points:
    150
    #9
    Simplier solution is to not embed public folders into protected ones, i.e. refactor your folders structure.
     
    wmtips, May 7, 2008 IP