Jump to content

Hotlink Protection


TCH-Tim

Recommended Posts

I tried searching the forums but couldn't find exactly what I was looking for. I'm not sure if hotlink protection is the term I should be using, but here's what I want to do:

 

file.wmv has been downloaded 1800 times from a site that is not mine. I would like to redirect people trying to download file.wmv to a specific page on my site where they can download it. At least that way there's a shot I will get traffic to other parts of my site.

 

I don't want to turn on hotlink protection for the entire site or even the entire folder where file.wmv resides. I just want to redirect downloaders of that one file.

 

Thanks in advance.

Link to comment
Share on other sites

Rob is right. Changing the name will only work for so long. The search engines will catch up with me.

 

I may be asking a lot by leaving everything so open and expecting to restrict access to one file, but I have to believe there's a way.

Link to comment
Share on other sites

I have the same question about a jpg of my daughters headstone that some kid on a social networking site is using as her avatar.

 

I understand that once you put something on the web, you cant control how it is used. I just hate seeing the stats for that file being so abnormally large. I'm not too overly sensitive about it (otherwise it wouldn't be on the web), I just hate the feeling of how irreverent it is.

Link to comment
Share on other sites

You can either put a redirect on that referrer (as Bruce suggests) or you should be able to do hotlinking on the single file by editing the .htaccess and adding something like;

 

>RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://mywebsite.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://mywebsite.com [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mywebsite.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mywebsite.com [NC]

RewriteRule file.wmv - [F,NC]

Link to comment
Share on other sites

Thanks Andy, that got me on the right track. Took me a few tries to realize it needs to be in the /public_html/ .htaccess, not the /public_html/files/ .htaccess. Made a minor modification to Andy's suggestion. Rather than forbidding the file, I redirect the visitors to the actual post page that discusses the file, and they can get to it from there. Changed the last line of Andy's code to:

 

>RewriteRule file.wmv http://www.mysite.com/somepostpage [R,NC]

 

Appreciate the help guys.

Link to comment
Share on other sites

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...