[pmwiki-users] Ban a domain?

Patrick R. Michaud pmichaud at pobox.com
Sat Oct 27 20:14:23 CDT 2007


On Sat, Oct 27, 2007 at 08:33:10AM -0700, pmwiki at 911networks.com wrote:
> Hi,
> 
> Is there a way to ban a domain from accessing my wiki? I don't
> just want to ban them from posting, but I want to ban them 
> from reading/accessing the wiki.

Normally I do this from within the webserver configuration itself
rather than trying to do it within PmWiki.  It's more efficient
that way.

In Apache, I use the following (replacing the IP address with
one appropriate for the domain).

    Deny from 192.168.1
    Deny from example.com

Supposedly it also works for domain names:, but I suspect this
would require that reverse DNS mapping is properly in place
for a given set of IP addresses, which may or may not be true.
For example, 

    Deny from pmwiki.org

might not do anything at all, because the IP addresses for the pmwiki.org
domain actually reverse to 'pmichaud.com'.

If you really want to do it from within the PmWiki config, then try
blocking things based on the $_SERVER['REMOTE_ADDR'] and/or
$_SERVER['REMOTE_HOST'] variables:

    if (preg_match('/^192.168.1/', @$_SERVER['REMOTE_ADDR'])) {
        print("Access denied.");
        exit(0);
    }

Pm



More information about the pmwiki-users mailing list