denying access to a directory with htaccess

denying access to a directory with htaccess

Posted by: desbrina
Posted on: 2009-05-05 03:46:00

I'm trying to deny access to a directory using htaccess. After reading on the net i think i have the code correct, but all it does is give Internal Server Errors. Someone on another forum said the code should work

Here's what i'm using

In reply to:

<Files .htaccess>
order allow,deny
deny from all
</Files>

<Directory "scripts">
Order Deny,Allow
Deny from All
</Directory>

ErrorDocument 403 /403.php
ErrorDocument 404 /404.php


Here's what the error log gives

In reply to:

[Tue May 05 03:41:42 2009] [alert] [client hidden] /home/calona/calona/.htaccess: <Directory not allowed here
[Tue May 05 03:41:42 2009] [alert] [client hidden] /home/calona/calona/.htaccess: <Directory not allowed here
[Tue May 05 03:41:54 2009] [alert] [client hidden] /home/calona/calona/.htaccess: <Directory not allowed here
[Tue May 05 03:41:54 2009] [alert] [client hidden] /home/calona/calona/.htaccess: <Directory not allowed here
[Tue May 05 03:42:09 2009] [error] [client hidden] client denied by server configuration: /home/calona/calona/.htaccess
[Tue May 05 03:42:09 2009] [error] [client hidden] File does not exist: /home/calona/calona/403.php
[Tue May 05 03:42:33 2009] [alert] [client hidden] /home/calona/calona/.htaccess: <Directory not allowed here
[Tue May 05 03:42:33 2009] [alert] [client hidden] /home/calona/calona/.htaccess: <Directory not allowed here
[Tue May 05 03:42:36 2009] [alert] [client hidden] /home/calona/calona/.htaccess: <Directory not allowed here
[Tue May 05 03:42:36 2009] [alert] [client hidden] /home/calona/calona/.htaccess: <Directory not allowed here


Anyone know what's wrong?

Re: denying access to a directory with htaccess

Posted by: Atropos7
Posted on: 2009-05-05 06:42:00

In reply to:

Anyone know what's wrong?


The error log is telling you what is wrong! You can't use the Directory clause in an .htaccess file. You would know that if you read the documentation: http://httpd.apache.org/docs/

Since .htaccess files are "per-directory configuration files" just place the relevant directives in an .htaccess file inside the directory you want to deny access to.



cool openvein.org -//-

Tags: internal server errorshtaccessreply