Forum Moderators: phranque

Message Too Old, No Replies

rewrite only works when the page is not fully loaded

         

zeus

12:39 pm on Feb 10, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok here we go, i have a rewrite like this

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site.com [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ [othersite.com...] [R,NC]

So another site is linking directly to my images, but with a text link, when that site is not fully loaded or mine not sure, be cause they also frame some of my site, then the text link goes to "othersite.com which is great, but when the site is fully loaded or mine, it goes to my image, so whats wrong here. It must be some timing or something, be cause the redirect in a way works.

g1smd

12:57 pm on Feb 10, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Remember that your browser caches images and states so you need to flush your browser cache between tests.

Since your code has a [R] flag it generates a redirect. It is not a rewrite.

It's confusing stuff that RewriteRule can be used for both redirects and rewrites.

zeus

2:24 pm on Feb 10, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



yes i have cleared cache. redirect or rewrite would that chance anything. I just checked again, it really only works when the scraped page(my page) is not fully loaded, then there text link goes to my redirect site, but fully loaded it goes directly to my image.

lucy24

9:17 pm on Feb 10, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Is this meant to be an anti-hotlinking routine? If so, it's normally done with a plain Rewrite. No matter what the unwanted visitor requests, you show them an uninviting image. Be sure to design something that's recognizable at all sizes, because some hotlinks include height and width declarations.

Or do you mean that the text says "look at this cool picture!" with a clickable link that they didn't get your permission for? In that case a redirect is probably more appropriate. It is your site's way of saying "Neener-neener, I know what you're trying to do!"

Unfortunately it is impossible for htacess to tell which type of link it is. It just comes through as referer either way. So if you happen to know it's a text link, you have to code it by name.

zeus

9:51 pm on Feb 10, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



yes the situation is this : they load a scraped version of my site in a frame, next to it they have a link text, that links directly to my image jpg, i have then noticed when the scraped version of my site is not loaded fully be cause of large image, the text link next to it works as I want it, they are linked to a site of mine, but when the scraped version is fully loaded on there site, that text link next is linking directly to my jpg.

Now the text is always the same.

thanks for your reply, you must be the expert here.

zeus

10:11 pm on Feb 11, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have noticed with wordpress there the text link have no changes, there the hotlink works