LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 10-27-2008, 05:52 AM   #1
Nemie
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:
http://skutt.net/error_pages/
On that link the 404/403.html shows up.
On other sites like:
http://skutt.net/.files/

I just get the plain:
Code:
Forbidden

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:
Code:
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 skutt.net /var/www/html/skutt.net/.

What have I done wrong?
 
Old 10-28-2008, 11:09 PM   #2
dkm999
Member
 
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:
Code:
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.
 
  


Reply

Tags
access


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 05:07 PM
how to modify ERROR 404 (html) and put my own page?? mandriva 2006 ssarrinah Mandriva 2 06-04-2008 08:26 PM
httpd 403 forbidden index.html question Amuro-Ray2020 Linux - Server 1 07-11-2007 08:00 PM
locolhost errors to a gif file and not a Html 404 error almost000 Linux - Software 5 06-02-2007 03:22 PM
apache 403 for dir in /var/www/html/ m3rajk Linux - Networking 7 10-11-2005 02:31 PM


All times are GMT -5. The time now is 04:49 PM.

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