how and where to set override and directory DIRECTIVES

Discussion in 'Apache' started by ozren, Jan 23, 2012.

  1. #1
    Hello all,

    I am new to all of this, doing it for the very first time, so excuse any stupid questions. I am trying to set up a basic password protection for a folder on my site. I am using dreamweaver to build the site and have login credentials for an Apache server at my university that is hosting the site.

    I am not the server administrator thus I am taking the .htaccess route to set up authentication. I understand this step.

    What I don't get is how to set up AllowOverride directive described here (http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride) and a directory directive described here (http://httpd.apache.org/docs/2.0/mod/core.html#directory)

    If I am not the server administrator, where do I apply these directives? Do I simply create a text document and type the following:

    <Directory /my/directory/to/which/I/want/override>
    AllowOverride All
    </Directory>

    If so, where then do I put this plain text file and what do I name it?

    Thank you so much for your help and time.

    Ozren
     
    ozren, Jan 23, 2012 IP
  2. JamesZach

    JamesZach Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You would need to put these directive in .htacsess file and the .htaccess file should reside in directories that comes under the DOCUMENT ROOT directory of the virtual host that you are trying to access via web.
     
    JamesZach, Jan 24, 2012 IP
  3. ozren

    ozren Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi James,

    Thank you for your help. I just some follow up questions. So my .htaccess file would look something like this:
    I found the DOCUMENT ROOT but putting a file with phpinfo in the folder that I wanted to protect, then going to it online...

    <Directory /home/www/storytelling.concordia.ca/>
    AllowOverride All
    </Directory>
    AuthType Basic
    AuthName "restricted area"
    AuthUserFile /home/www/storytelling.concordia.ca/.htpasswd
    require valid-user

    Would everything be put within the <directory> directive or is it separate like above?
    My .htpasswd file would simply be the user name and password separated by a colon and saved as .htpasswd, like this:

    username : password
    (with no space between the : )

    Would the directory path for the AuthUserFile be the ROOT DIRECTORY? Or would it be the exact path to the folder I am trying to protect. I was under the impression that I wanted to put .htaccess and .htpassword directly into the folder (such as 'passwordpaper') that I wanted to protect?

    Thank you so much for your help...
     
    Last edited: Jan 24, 2012
    ozren, Jan 24, 2012 IP