Results 1 to 5 of 5

Thread: .htaccess file

  1. #1
    Join Date
    Jan 2006
    Location
    Brampton, Ont
    Posts
    42
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default .htaccess file

    My .htaccess file is shown below;

    AuthName "Restricted Area"
    AuthType Basic
    AuthUserFile /home/bcfchurch.net/.htpasswd
    AuthGroupFile /dev/null
    require valid-user


    and the .htpasswd in place in the same directory as my public (main) directory, but the htaccess cannot find the htpasswd file.

    Is this line correct?
    AuthUserFile /home/bcfchurch.net/.htpasswd

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I am not an expert with .htaccess, but I notice two things:
    1. That's a very short directory structure compared to what I expect from a server. Is /home/bcfchurch.net really the whole path? If so, that should be fine. But you could check that (in PHP, for example, with echo __FILE__; to find its path).
    2. This is using an absolute path, but why not use a relative path? Of course this relates to where the current location of this .htaccess file is.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. The Following User Says Thank You to djr33 For This Useful Post:

    Jamcan (05-03-2010)

  4. #3
    Join Date
    Jan 2006
    Location
    Brampton, Ont
    Posts
    42
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    How do I use the relative path? How do I get any path?

  5. #4
    Join Date
    Jan 2006
    Location
    Brampton, Ont
    Posts
    42
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    I am not an expert with .htaccess, but I notice two things:
    1. That's a very short directory structure compared to what I expect from a server. Is /home/bcfchurch.net really the whole path? If so, that should be fine. But you could check that (in PHP, for example, with echo __FILE__; to find its path).
    2. This is using an absolute path, but why not use a relative path? Of course this relates to where the current location of this .htaccess file is.
    Not sure how to do this in PHP, for example, with echo __FILE__; to find its path

  6. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    You just need to figure out the full directory structure of your host. If you happen to know how to use PHP then that's an option. You could also use ONLY <?php phpinfo(); ?> in a page called "test.php" and find the path that way, I believe.

    Regardless, try to look a the documentation for your host to see what the file structure is.

    A relative path is just like "file.ext" rather than "/base/directory/file.ext" when you are currently in the same area. So see if you can figure out what that is. In other words, if the password file and the htaccess file are in the same place, then you just need the NAME of the file. If it's in a different location, you will use the relative path like: "../parallelfolder/.htpasswd"
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

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