cancel
Showing results for 
Search instead for 
Did you mean: 

.htaccess - blocking visitors??

N/A

.htaccess - blocking visitors??

I've tried but I can't get .htaccess to work.

the file contains:
order deny,allow

deny from 172.16.140
deny from 80.229.228.49
deny from 172.16.57.3
deny from 172.16.57.4
deny from 172.16.57.6
deny from 172.16.57.7
allow from all


I have a re-direct set up from my homepage pointing to my cgi space, and have tried putting the .htaccess file in a subfolder on the homepage server and can browse to that successfully, despite the setting - so it's not working.

I'm trying to ban my own IP from the subdirectory, and IP's within a private domain - though not all - are either of these things possible??

Is there another way to deny access? I have heard it may be possible within php?Huh
7 REPLIES
LiamM
Grafter
Posts: 5,636
Registered: 12-08-2007

.htaccess - blocking visitors??

Unfortunately, Plusnet do not support this feature of htaccess.

I'm not aware of any other ways in which this can be done, but someone with more experience than myself will undoubtedly pick this up in due course.
N/A

.htaccess - blocking visitors??

Well thanks for the reply anyway! Smiley

I was under the impression that it DID work on the homepages server - just not the CGI server. Obviously I was wrong then Sad

Maybe I could try redirecting to a free host - filtering using .htaccess there, before redirecting again to the real page...

...i'd just like to add that the reason I need the block is because of wordpress comment spammers. Looking at my stats the spammers are constantly attacking it. This is taking up unnecessary bandwidth.

I doubt if my double re-direct will affect these - as they just home straight in on it.

my stats page: http://cgi.s1mps.plus.com/bbclone/show_global.php?lng=en
LiamM
Grafter
Posts: 5,636
Registered: 12-08-2007

.htaccess - blocking visitors??

Quote

I was under the impression that it DID work on the homepages server - just not the CGI server. Obviously I was wrong then Sad


In that case I could be wrong. I thought it didnt work on either, but that was an assumption. Perhaps somebody else can clarify? I thought it was standard across the two platforms.
N/A

.htaccess - blocking visitors??

It should work on Homepages.

However, this problem is caused by your "order" statement.

Upon reading the apache manual for the Order directive, it states the following.

Quote
On the other hand, if the Order in the last example is changed to Deny,Allow, all hosts will be allowed access. This happens because, regardless of the actual ordering of the directives in the configuration file, the Allow from apache.org will be evaluated last and will override the Deny from foo.apache.org. All hosts not in the apache.org domain will also be allowed access because the default state will change to allow.


To put this into perspective from your example.


order deny,allow
deny from 172.16.57.7
allow from all


As "allow from all" is evaluated after the deny rule, it overides the deny from host X.

As such, simply change the order statement around.
N/A

.htaccess - blocking visitors??

aha! thanks very much both.

Very confusing that!

Just need to find a way of blocking wordpress bots now!

much obliged. Cheesy
LiamM
Grafter
Posts: 5,636
Registered: 12-08-2007

.htaccess - blocking visitors??

Apologies Shockedops: Learn something new every day!
N/A

php answer

Well that didn't work - and i've just found what I was looking for... over at hotscripts - IP blocking using php useragent: http://www.hotscripts.com/Detailed/36074.html