homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

.htaccess deny special error pages
Is this possible?

10+ Year Member

Msg#: 4224606 posted 6:26 pm on Oct 31, 2010 (gmt 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
allow from all

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?



10+ Year Member

Msg#: 4224606 posted 3:43 pm on Nov 2, 2010 (gmt 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.).



10+ Year Member

Msg#: 4224606 posted 4:06 pm on Nov 2, 2010 (gmt 0)

Tom that is very helpful, thank you.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved