Forum Moderators: phranque

Message Too Old, No Replies

block header redirect

         

santi

11:10 am on Feb 5, 2005 (gmt 0)



Hi
Im trying to block some external redirect to my site
I think that they use header location to redirect

when you enter this domain
http://www.example.com.br
they redirect to my domain
http://www.example.com/fioridimare/

How can I block this redirects?

[edited by: jdMorgan at 4:03 pm (utc) on Feb. 5, 2005]
[edit reason] Removed specifics per TOS. [/edit]

jdMorgan

4:13 pm on Feb 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Santi,

Welcome to WebmasterWorld!

About the best you can do is to check the HTTP_REFERER using mod_rewrite, and block accesses if the referrer is that other site. This doesn't always work, because not all requests will have a referer header. But it will block enough of the hotlinked request to make the other site look broken.

An alternative is to change the URL they are linking to, again making their site look broken. If they change their link, then change your URL again.

A more reliable way to prevent hotlinking is to set a cookie on your home page, and then use a script to check that cookie before serving the content of the page(s) being hotlinked. This is much more reliable, but it requires even your legitimate users to access the page that sets the cookie before they can access the contents of the page you have protected.

Jim