Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2003
    Location
    Cambs, Uk
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    .htacces problem

    Hi Everyone
    I have successfully set up a htaccess and htpasswd file to protect a members area of my website but . . .it password protects the whole site and not the set of pages i want it to.
    This is what i have as the .htaccess file:

    <Directory/members_only_page>
    AuthType Basic
    AuthUserFile .htpasswd
    AuthName "Please enter your username and password"
    require valid-user
    </Directory>

    and i have saved it into the folder where all the member pages are going to be.
    The other pages for the site are in the root directory, and the members pages are in a seperate folder in the root directory, and the htaccess and htpasswd files are in the members folder.
    What am i doing wrong/missed?
    It's the first time i've done this so please explain in simple terms, and i have read the htaccess posts in the forum and the link that goes to the htaccess explanation. I get how to do the files, it's just where to put them so that only the pages i want protecting are protected and not the whole site.
    I hope that made sense!
    Thank you

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    save in the folder you want to protect (will protect sub-folders as well ) without the <directory> tags or use the full path to the directory !

    but just ...

    AuthType Basic
    AuthName "Please enter your username and password"
    AuthUserFile /home/user/full/path/to/.htpasswd
    require valid-user

    would be fine
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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