Jump to content

Recommended Posts

Posted (edited)

I have been working on this for days, and I'm sure you've seen several posts from me related to mod rewrite and trying to block sites. I have been reading and reading and trying and trying and I'm just not getting it. I actually dumped my entire .htaccess file (backed up of course) and put only the following in it:

 

>RewriteEngine on
#I tried with and without RewriteBase /
RewriteBase /  
RewriteCond %{HTTP_REFERER} (somesite\.com) [NC]
RewriteRule .* bad-referer.php [L]
#or RewriteRule .* - [F]

 

I linked from somesite.com and it doesn't work. :blink: I don't get it, what'd I miss?

Edited by boxturt
Posted (edited)

Hello,

 

Try this:

 

>RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://(www\.)?somesite.com*$ [NC]
RewriteRule (.*) /bad_referer.php [R,NC,L]

 

(The R is needed for a redirect)

 

Jimuni

Edited by Jimuni
Posted

Looks frightening :blink: but I'll give it a go a little later. I've got to teach a few students today, yup, even on Sunday.

 

Thanks, I'll report back B)

Posted

Thanks Jim but unfortunately it didn't work. I changed 'somesite', and 'bad_referer' to match my needs and put it in htaccess and no go. Then I backed up that one and started fresh and put the code in a fresh htaccess. It's the only thing in the file and it doesn't work.

 

Soooooooo confused. BTW, this all started because I noticed I was starting to get hits from sites I had previously blocked, which is odd in itself. :blink:

Posted (edited)

:blink: Still no luck, and it is the only thing in the file.

 

I should probably mention that I've tried it on a couple differnt sites,

on different servers, with the same results.

Edited by boxturt
Posted

Hello,

 

Another version, although all the logic for these htaccesses assumes though that the domain name this website is using is the one doing the fetching (e.g. its not a frame link or something)

 

>RewriteEngine on
RewriteCond %{HTTP_REFERER} ^(http://)?(www\.)?deals.*$ [NC]
RewriteRule .* - [F,L]

 

Just try replacing "deals" with the middle part of the domain name, don't piut a domain ending and leave the rewrite as is.

 

Jim

Posted

No luck. I've tried all of the suggestions I can find, tried implementing them on 4 different sites across 3 servers. That has me convinced that it's me but I'm pretty sure I'm doing them all correctly:

 

>RewriteEngine on
RewriteCond %{HTTP_REFERER} ^(http://)?(www\.)?boxturt.*$ [NC]
RewriteRule .* - [F,L]

 

This is starting to stress me ouuuuuuuuut!! :notworthy:

 

Ah well, I'm still trying

Posted

Nope, nothing lurking about to override.

Permissions set to 644(?)

 

I originally tried this on a large site, on a different server, with an already large htaccess file and it didn't work. I thought hm, strange, let's go test it from a smaller site with a really small htaccess just to test. Didn't work there either. Then I eliminated everything in the file except for the snippet(s) that won't work.

Posted

I found the problem! And I'm none too happy about it.

 

Thank you Norton, you piece of ............ um family forum Ty, be nice. Ahem

 

Norton Internet Security 2006 apparently doesn't send headers or something wierd - I don't know what-all except that when I turned it off temporarily all the blocks and domain-based redirects worked perfectly.

 

Ok, I searched a bit and found that NIS does NOT send referer headers by default.

 

Grr, this has some nasty implications then doesn't it?

Posted
Thank you Norton, you piece of ............

 

I'll second that! :P

 

First thing I remove when I purchase a new computer that comes with it.

 

Anyway, glad you sorted it out.

Posted

I have Norton Internet Security 2005. The setting that control whether referers are sent or not is under "Norton Internet Security", "Privacy Control". Click the 'Configure' button, then the 'Custom Level' button. The 'Enable Browser Privacy' checkbox will turn referers off and on when it is checked or unchecked.

 

Also, you can click the 'Advanced' button and referer sending can be configured on a global basis as well as per domain (the "Information about visited sites" box)

Posted

Thanks for that David, and thanks to everyone else who responded.

 

This is far from the first issue I've had with NIS and probably not the last. If it weren't for TCH - Andy helping me a while back on the problem of NIS injecting code into pages I wouldn't have thought to look there at all.

 

So I'm guessing there is no way to block a domain if there are no headers sent?

 

I have another related issue / question but I think I'll start a new topic :P

Posted

Hello Boxturt

 

Norton :P Personnelly can't stand it and like TCH-Bruce, first thing that was deleted. I now use the CD as a rather good coffee coster.

 

Could be very difficult to block a domain if no headers are sent. It might also explain why you are now getting hits from the old domain name that you had blocked.

 

Nice going though!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...