Forum Moderators: phranque

Message Too Old, No Replies

subdomain and specific url bans

htacess bans

         

soapystar

4:16 pm on Oct 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



currently to ban domains i have

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www\.)?bad.com/.*$ [NC,]
RewriteCond %{REQUEST_URI} ^/.*$

to ban another.bad.com (subdomain) how would i add that? Plus to ban a single specific url
another.bad.com/file.htm

how would i add that?

cheers!

soapystar

5:06 pm on Oct 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



basicaly the following script is failing and in not sure y....

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www\.)?domain1.com/.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?domain2.com/.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://sub.domain.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://sub2.domain3.com/directory [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://www.domain4.net/file.htm [NC,]
RewriteCond %{REQUEST_URI} ^/.*$

jdMorgan

6:55 pm on Oct 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



[NC,] is not valid, it should be [NC]
Do you have a RewriteRule following all these RewriteConds? If not, the code won't do anything.

Jim

soapystar

7:38 pm on Oct 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



duh!

:)

to ban those domains from getting any type of file including html, how should that rule end?

jdMorgan

8:20 pm on Oct 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The simplest method is to return a 403-Forbidden response:

RewriteRule .* - [F]

However, if you use a custom error page for 403 responses, then you'll need to exclude that page from being fobidden itself:

RewriteRule !^path_to_custom_403_page\.html$ - [F]

There are plenty of examples here of this kind of stuff. Try the "Close to perfect htaccess ban list" threads, for example.

Jim