Welcome to WebmasterWorld Guest from 54.162.104.113

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

.htaccess deny special error pages

Is this possible?

     
6:26 pm on Oct 31, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 19, 2002
posts: 423
votes: 0


I have something like this in a site's htaccess

<Limit GET POST>
order allow,deny
deny from xx.xx.xx.xx
deny from xx.xx.xx.xx
etc.
allow from all
</Limit>

I am going to add a range

deny from xx.xx.xx.*

But I would like only the users of this range of blocked IPs to see a special error page for them.

Is this possible?
3:43 pm on Nov 2, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:June 10, 2003
posts: 410
votes: 0


Hi georgeek --

I think you may have the wrong approach here. See the docs on the use of the <Limit> section ... it pretty much comes out and says not to do what it looks like you're doing :-) [httpd.apache.org...]

The idea of using allow and deny is fine in general, but I think in your case, you want to respond specially to an IP address range by returning a special page. Take a look here in the doc for a couple of approaches to consider. [httpd.apache.org...]

I think you may want to look at RewriteRule and RewriteCond -- the condition is that the requesting IP address matches a range, and RewriteRule would be to send a 403 response and a specific page back.

Take a whirl after reading the docs, and also search here for examples of cases where people have done the same thing. If you're out of luck after that, please let us know what you're trying to accomplish (why is this IP address range special, what kind of message, etc.).

Tom
4:06 pm on Nov 2, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 19, 2002
posts: 423
votes: 0


Tom that is very helpful, thank you.