1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Swapping File For Hotlinking Sites

Discussion in 'General Programming Chat' started by Lickalotpuss, Aug 15, 2010.

  1. Lickalotpuss

    Lickalotpuss Registered Member

    Joined:
    May 11, 2010
    Messages:
    84
    Likes Received:
    8
    Hey guys,

    I have encountered a site that is hotlinking something from me. I was wondering how I can easily swap the file on his site to something of mine? As of right now he is stealing a swf file. With cPanel hotlink protection it stops his site no sweat but I would like to put a gif or another swf if I have to that says something like "Check out the best site on the net! Click here" and pull his traffic to my site.

    Any ideas? I know that I can just rename the file on my site and name the click here file the name he is using on his site but I would like something automatic for the future as well.

    Thanks for the ideas.
     
  2. likeskoolaid

    likeskoolaid Regular Member

    Joined:
    Dec 27, 2009
    Messages:
    352
    Likes Received:
    104
    Occupation:
    \˚ㄥ˚\
    Location:
    \ᇂ_ᇂ\
    You kind of answered your own question there.
     
  3. Lickalotpuss

    Lickalotpuss Registered Member

    Joined:
    May 11, 2010
    Messages:
    84
    Likes Received:
    8
    Well i mentioned one way to do it but I would like it automatic. I dont want to check whos hotlinking me and change files whenever it happens. Auto is what im looking for.
     
  4. likeskoolaid

    likeskoolaid Regular Member

    Joined:
    Dec 27, 2009
    Messages:
    352
    Likes Received:
    104
    Occupation:
    \˚ㄥ˚\
    Location:
    \ᇂ_ᇂ\
    Put this in your .htaccess file.
    Code:
    # hotlinking
    
      RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?yoursite\.com/ [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourblog\.com/ [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?your\.friends\.
    site\.com/ [NC]
    RewriteCond %{REQUEST_URI} !hotlink\.(gif|png|jpg) [NC]
    RewriteRule .*\.(gif|png|jpg)$ /images/hotlink.jpg [NC] 
    
    Replace /images/hotlink.jpg with your own hotlink replacement image. And replace the URL locations, formatted as they are, with your own. You don?t have to include YOUR site, just sites you allow to use your server images on.
     
  5. Lickalotpuss

    Lickalotpuss Registered Member

    Joined:
    May 11, 2010
    Messages:
    84
    Likes Received:
    8
    that didnt seem to work for me. Maybe because the file that was being hotlinked was a swf and I was replacing with a jpg?

    Thanks
     
  6. likeskoolaid

    likeskoolaid Regular Member

    Joined:
    Dec 27, 2009
    Messages:
    352
    Likes Received:
    104
    Occupation:
    \˚ㄥ˚\
    Location:
    \ᇂ_ᇂ\
    did you change

    Code:
    RewriteRule .*\.(gif|png|jpg)$ /images/hotlink.jpg [NC]
    
    
    to

    Code:
    RewriteRule .*\.(swf)$ /images/hotlink.jpg [NC]
    
    
    if that still doesn't work just make a flash for your hotlink, those are better anyways because as you said in the op you can make it click able and lead to your site to screw with them even more.
     
  7. Lickalotpuss

    Lickalotpuss Registered Member

    Joined:
    May 11, 2010
    Messages:
    84
    Likes Received:
    8
    Hey,

    I did make the swf change. But I think because the code they are using <embed> doesnt work with an image. So I might make up a swf for to get their traffic.

    Thank you very much for the code. I have it saved!