Closed Thread Icon

Topic awaiting preservation: Still Have Referrer Problem (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12614" title="Pages that link to Topic awaiting preservation: Still Have Referrer Problem (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Still Have Referrer Problem <span class="small">(Page 1 of 1)</span>\

 
Wes
Paranoid (IV) Mad Scientist

From: Inside THE BOX
Insane since: May 2000

posted posted 02-15-2003 18:34

Okay, I have to get back to this pop-up script that's causing me problems in NN4. (There was a topic on its development in DHTML/Javascript, but it seems to have vanished.)

Here's the deal. I'm using the following in my .htaccess file to disallow linking to my images from other sites (except for mine and the Asylum):

<BLOCKQUOTE><FONT face="Verdana, Arial">code:</font><HR><pre>
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?bigwaste.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?texastwisted.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?ozoneasylum.com.*$ [NC]
RewriteRule \.(gif

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 02-15-2003 23:00

Hey Wes.

Now unfortunately I'm not very good with the rewrite rules but, here's what I know (or think I know ) I don't think you can fake a referrer with anything in the popup however what you should be able to do is rewrite your rule so that it checks not only the referrer but also the user agent. This would allow you to write it so that if referrer is blank and the User Agent is Netscape Navigator it will still serve the image.

Someone should be able to help you with this more.



.:[ Never resist a perfect moment ]:.

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 02-15-2003 23:50

Wes -

The very best info I've ever seen has come from the guys in a thread called "A Close to perfect .htaccess ban list" at Webmasterworld.com.

That site is quite informative, and I recommend it for things like this.

Hope this helps!

Wes
Paranoid (IV) Mad Scientist

From: Inside THE BOX
Insane since: May 2000

posted posted 03-07-2003 01:05

Okay, I've found a little time to get back to this...

Pugz - I looked through as much of that thread as I could. Quite overwhelming, honestly. Couldn't seem to extract what I needed.

bit - I think you've got the right idea, but I can't seem to make it work.

Maybe someone else can jump on this, too...

1. I don't think I know how to say "If there's no referer..."
2. Is RewriteCond %{HTTP_USER_AGENT} ^Mozilla/4.*$ [NC] correct to refer to all 4.x version of NN?

And, BTW, what does RewriteCond %{HTTP_REFERER} !^$ in my example code above mean exactly?


Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 03-07-2003 15:37

RewriteCond %{HTTP_REFERER} !^$
means - everything that does not send an empty referer (! means not, ^ means start, $ means end)

so long,

Tyberius Prime

Wes
Paranoid (IV) Mad Scientist

From: Inside THE BOX
Insane since: May 2000

posted posted 03-07-2003 21:11

Ah, that's what I thought. So, wouldn't it be irrelevant in the logic above? After all, I want anything that doesn't match my URLs to return the forbidden graphic. So, if I'm thinking correctly, anything that doesn't return a referer still doesn't match the defined URLs, so it would qualify for the rewrite anyway. I could remove that line and it should still work, right?

However, I could use it without the ! in the logic I'm attempting to accomplish...

code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^$ [b]# Anything that returns an empty referer...[/b]
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/4.*$ [b]# ...whose user_agent matches that of NN 4.x...[/b]
...then allow image requests, however I say this. [L]



Does that make sense?

I'm poring over the Apache documentation on mod_rewrite, but I swear most of it is in a different language.

Wes
Paranoid (IV) Mad Scientist

From: Inside THE BOX
Insane since: May 2000

posted posted 03-07-2003 21:37

Ooh, okay, how about this? (Sorry, I have to think aloud or else I'll forget all this. Since I'm at work, I can't try any of it just yet.)

<BLOCKQUOTE><FONT face="Verdana, Arial">code:</font><HR><pre>
RewriteEngine on

RewriteCond %{HTTP_REFERER} ^$ [C]
# If the referer is empty... (If it's not, skip the next rule because it's [C]hained.)
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/4.*$ [S=4]
# ...and if the user_agent is NN 4.x, then skip the next 4 rules, effectively ending the sequence.
# Otherwise, continue.
# (I'm still not sure the syntax of this condition is correct, or whether I need a [NC] flag.)

RewriteCond %{HTTP_REFERER} !^http://(www\.)?bigwaste.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?texastwisted.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?ozoneasylum.com.*$ [NC]

# If the referer doesn't match any of the URLs above...
<B>RewriteRule \.(gif

AT
Bipolar (III) Inmate

From: Louisville, KY, USA
Insane since: Aug 2000

posted posted 03-08-2003 00:50

First, I don't know anything about this so I'm sorry to make you look.
I just have to say this is priceless!

'please let me know now before I realize I'm an idiot on my own.'


Cheers

Wes
Paranoid (IV) Mad Scientist

From: Inside THE BOX
Insane since: May 2000

posted posted 03-09-2003 02:31

Argh! All I get with this is an internal server error.

The logic seems to make sense. I have no idea what I'm doing wrong here. Bleh!


Wes
Paranoid (IV) Mad Scientist

From: Inside THE BOX
Insane since: May 2000

posted posted 03-17-2003 00:00

Okay, space cadets. I leave you with this in case you come across a similar problem. Someone over at WebmasterWorld helped me track this down.

When the referer is a dynamically created document (i.e. created using document.write) in a pop-up window, NN4's referer will look like this:

code:
[b]wysiwyg://0/[/b]http://www.domain.com/document_that_created_the_popup.html



(A little searching suggested that 0 may not always be 0, but some other number, but that was easily compensated for in my RewriteCond.)

Now that my RewriteCond reads as follows, I no longer have any problem with the images in the pop-up being replaced with the "denied" image:

code:
RewriteCond %{HTTP_REFERER} !^(wysiwyg://[0-9]{1,2}/)?http://(www\.)?texastwisted.com.*$ [NC]



Edit: Found a better way to compensate for that possibly changing number.



[This message has been edited by Wes (edited 03-17-2003).]

Wes
Paranoid (IV) Mad Scientist

From: Inside THE BOX
Insane since: May 2000

posted posted 03-20-2003 03:50

For posterity, I'd like to add something else I found out.

NN7 for Mac, possibly other versions, uses the prefix wyciwyg. Note the c rather than an s.

Happy searching.




[This message has been edited by Wes (edited 03-22-2003).]

« BackwardsOnwards »

Show Forum Drop Down Menu