LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache .htaccess error (https://www.linuxquestions.org/questions/linux-server-73/apache-htaccess-error-646902/)

zerocool22 06-04-2008 04:19 AM

Apache .htaccess error
 
Hey, i just copied a .htaccess file to a folder from my apache, and when i try to acces it i get an internal server error.

Wed Jun 04 11:11:35 2008] [alert] [client ip] /home/test/.htaccess: AllowOverride not allowed here

.htaccess
Quote:

AuthType Basic
AuthName "Give in Kerb 5 Username and Password Required active directory"
Require valid-user

AllowOverride None
When i set this to my httpd.conf it does work, just the .htaccess files are failing me.

Should i post my httpd.conf?

bathory 06-04-2008 04:56 AM

The AllowOverride is available only in a <Directory...>...</Directory> section. If you want to restrict access in a directory using .htaccess, then you must put:
Code:

AllowOverride AuthConfig
inside that <Directory> section in httpd.conf.

zerocool22 06-04-2008 04:58 AM

So change .htaccess to this?
Quote:

AuthType Basic
AuthName "Give in Kerb 5 Username and Password Required active directory"
Require valid-user

AllowOverride Authconfig
Then in httpd.conf comment out all <directory> allowoveride all <...>?

zerocool22 06-04-2008 05:03 AM

hmm it dont work, now it says:

[Wed Jun 04 12:01:18 2008] [error] [test 10.20.1.28] Directory index forbidden by rule: /home/

bathory 06-04-2008 05:53 AM

You didn't understand what I've told you.
If you want to restrict access to a directory (i.e. /home/test) by asking username/password, then you have to put .htaccess in that directory. The .htaccess should contain:
Code:

AuthType Basic
AuthName "Give in Kerb 5 Username and Password Required active directory"
Require valid-user
AuthUserFile    /path/to/ht-passwd

You need the path to the file that htpasswd creates passwords for the users that can access the protected directory.
In httpd.conf you should add (or edit if it exists) the following section:
Code:

<Directory /home/test>
...
AllowOverride Authconfig
...
</Directory>


zerocool22 06-04-2008 06:01 AM

ow, yeah if i put it in httpd.conf it allways work, but i have to do 380 folders, so i want to use .htaccess files to prevent anything changing in httpd.conf.

bathory 06-04-2008 06:16 AM

What exactly do you want to do with .htaccess? You can put the AllowOverride directive in the main <Directory ..>section and then use .htaccess on a per directory basis

zerocool22 06-04-2008 06:18 AM

So only the user from active directory which has acces to that specific folder gets to see the contents of that folder with apache. So i dont know for sure how to set my httpd.conf up, the authentication part works just fine. But the reading of .htaccess files is another thing. I have set up a folder with a .htaccess but it says AllowOverride not allowed here.


All times are GMT -5. The time now is 01:31 AM.