You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Carmel <ca...@hotmail.com> on 2011/05/13 17:08:27 UTC

[users@httpd] Custom Message

I am still trying to learn how Apache works so please bear with me.

I am using a "htaccess" file to limit certain IP from accessing my
server. This is the format of the file:

<Limit GET HEAD POST>
order allow,deny
deny from X.X.X.X
allow from all
</Limit>

This is working perfectly. Is there anyway I can have a custom message
displayed when a site listed in the above file is blocked?

Thanks!

-- 
Carmel ✌
carmel_ny@hotmail.com

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.
__________________________________________________________________


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Custom Message

Posted by Geoff Millikan <gm...@t1shopper.com>.
> Is there anyway I can have a custom message
> displayed when a site listed in the above file is blocked?

Yes, make a custom webpage for the 401 response:
http://httpd.apache.org/docs/2.2/mod/core.html#errordocument



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Custom Message

Posted by Mark Montague <ma...@catseye.org>.
  On May 13, 2011 11:08 , Carmel <ca...@hotmail.com> wrote:
> I am using a "htaccess" file to limit certain IP from accessing my
> server. This is the format of the file:
>
> <Limit GET HEAD POST>
> order allow,deny
> deny from X.X.X.X
> allow from all
> </Limit>
>
> This is working perfectly. Is there anyway I can have a custom message
> displayed when a site listed in the above file is blocked?

First, what you have above allows HTTP methods other than the three you 
list.  If you want to block all access from the above IP addresses, you 
should get rid of the Limit stanza and just put the Order, Allow, and 
Deny directives directly in the .htaccess file.

The ErrorDocument directive will allow you to control what the server 
returns to the client when access is denied:

http://httpd.apache.org/docs/2.2/mod/core.html#errordocument

You'll want to set up an ErrorDocument for the 403 status code.  If you 
include the ErrorDocument directive in your .htaccess file, it will only 
apply to resources at and below that level.

--
   Mark Montague
   mark@catseye.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org