Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 10-27-2008, 04:52 AM   #1
LQ Newbie
Registered: May 2008
Distribution: CentOS 5.2 Vserver / Fedora 9
Posts: 11

Rep: Reputation: 0
Question .htaccess 403/404.html not working properly

Hi, I have been trying to fix with my .htaccess files to restrict access to some catalogs on my webserver.

The problem is that the .html files I created only works when I type:
On that link the 404/403.html shows up.
On other sites like:

I just get the plain:

You don't have permission to access /.files/ on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
This is how the .htaccess file looks like:
ErrorDocument 404 /error_pages/404.html
ErrorDocument 403 /error_pages/403.html
order allow,deny
deny from all
The /error_pages/ lies in the root of /var/www/html/

What have I done wrong?
Old 10-28-2008, 10:09 PM   #2
Registered: Nov 2006
Location: Seattle, WA
Distribution: Fedora
Posts: 407

Rep: Reputation: 35
My reading of the order directive says that you ought to have this instead of what you have in your .htaccess file:
ErrorDocument 404 /error_pages/404.html
ErrorDocument 403 /error_pages/403.html
order allow,deny
allow from all
The reason is that Apache does not stop processing allow and deny directives when it gets a match. It processes all that it can find that apply to the object in question, and only then decides what to do. In the case here, it processes allow directives first, deny directives second. If at least one allow match occurs and no deny matches occur, access is allowed. But since deny directives are processed last, if any one of them matches, it does not matter that a previous allow directive matched; the request will be denied anyway.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do use htaccess to trigger an error 403 when a url contaiins a direction code? Usalabs Linux - Server 2 06-06-2008 04:07 PM
how to modify ERROR 404 (html) and put my own page?? mandriva 2006 ssarrinah Mandriva 2 06-04-2008 07:26 PM
httpd 403 forbidden index.html question Amuro-Ray2020 Linux - Server 1 07-11-2007 07:00 PM
locolhost errors to a gif file and not a Html 404 error almost000 Linux - Software 5 06-02-2007 02:22 PM
apache 403 for dir in /var/www/html/ m3rajk Linux - Networking 7 10-11-2005 01:31 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:53 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration