Forum Moderators: open

Message Too Old, No Replies

display error pages to banned users

.htaccess too aggressive

         

idiotgirl

12:54 am on Jun 28, 2002 (gmt 0)

10+ Year Member Top Contributors Of The Month



I have the SetEnvIf's working like a charm now, and my logfiles are filling to the brim with "denied by server configuration" lines. It's a beautiful thing ;)

However, I still want my error pages, which are in a folder (we'll call it error_pages... duh) to display the appropriate error message to banned users/abusers. This doesn't happen because the banned user or bot is being shunned alltogether.

So, could I do something like:

<Files ~ "error_pages/(401\.¦403\.¦404\.¦500\.)\.*htm$">
order allow,deny
allow from all
</Files>

in my .htaccess file? Sometimes my error pages end in .shtml, sometimes .htm or .html, so I need to cover those bases.

Key_Master

11:49 am on Jun 28, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, that will work. Place it after any other <Files></Files> you have.

<Files ~ "error_pages/(401¦403¦404¦500)\.(shtml¦html¦htm)$">
order allow,deny
allow from all
</Files>

idiotgirl

1:26 pm on Jun 28, 2002 (gmt 0)

10+ Year Member Top Contributors Of The Month



Key_Master - perfect. I wasn't sure about the order - but I'll try it at the tail end of my <Files> declarations. Thanks.

idiotgirl

6:03 am on Jun 30, 2002 (gmt 0)

10+ Year Member Top Contributors Of The Month



I added the code block and am getting mixed request responses in the log files.

Sometimes I get a 403 (or whatever custom error page) - such as in the case of if I typed in the URL to an image file when hot-linking is denied - and other times I get the generic Apache error page - in the case of a banned user going stright to the URL - with an additional error that the custom error page could not be displayed (because the access to any files has already been denied).

Strange.

Deny to get_out

is killing my custom error pages to the "get_out" IP's and I don't know a foolproof workaround.

Key_Master

2:27 pm on Jun 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I didn't catch it before, but you have a directory path in your Files which would cause the problem you described.

If you have other files using the same names you might want to change the error page names to something like error404.htm

Try:

<Files ~ "^(401¦403¦404¦500)\.(shtml¦html¦htm)$">
order allow,deny
allow from all
</Files>

idiotgirl

7:04 pm on Jun 30, 2002 (gmt 0)

10+ Year Member Top Contributors Of The Month



Aha. So... rename 401., etc. to error401.(extension) as -
<Files ~ "^error(401¦403¦404¦500)\.(shtml¦html¦htm)$">
order allow,deny
allow from all
</Files>

I'll see what happens with this. That's probably what the problem was. Thanks.