Jump to content

Recommended Posts

Posted

I have half a dozen or more subdomains but I only have one that I would like to set up Hotlink Protection. I tried to find a tutorial on how, but have not been able to find one as of yet so I'm giving up & asking for help :yes:

 

If I'm just being daft & overlooking it I apologize & would appreciate a point in the right direction :P (I'm not even really sure I've posted this in the right place! :) )

 

Thanks!

Posted

Put an .htaccess file in the main folder of the subdomain and put the following in it;

 

>RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(www\.)?your-domain\.com/ [NC
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.(jpe?g|gif|bmp|png)$ images/not-for-u.jpg [L]

 

This will prevent anything but your domain from being able to show the images.

 

The not-for-u.jpg should be an image stating no hotlinking or something like that.

Posted

Thank you Bruce. I have loved TCH in the almost year that I've been here & often stalk the forum for random bits of information :P

 

 

Ok, now I'm getting an "500 Internal Server Error" when I try to access that subdomain. Did I set up the .htaccess file incorrectly?

Posted

Rob's post was in error.

 

RewriteCond %{HTTP_REFERER} !^http://(www\.)?your-domain\.com/ [NC
It should have read:
RewriteCond %{HTTP_REFERER} !^http://(www\.)?your-domain\.com/ [NC]

 

He was missing the closing ]

 

And remember to replace the your-domain with your actual domain name.

Posted

I've got to be doing something wrong. Can I blame in on my lack of HTML skills & the cold meds I've been taking? :1eye: The 500 error is gone now but I can hotlink to the images in that subdomain.

 

Here's the code as I have it written:

RewriteEngine On

RewriteCond %{HTTP_REFERER} !^http://(cybervovvar\.)?simplesuccess\.us [NC]RewriteCond %{HTTP_REFERER} !^$

RewriteRule \.(jpe?g|gif|bmp|png)$ images/notforyou.jpg [L]

 

I created the .htaccess file by writing it in an HTML editor program I have & saving it as ".htaccess". When it uploaded it now reads as .htaccess

If I click for information on the files type it tells me it's a

File Type: ASCII text, with CRLF line terminators

 

Any ideas on what I'm doing wrong?

 

btw- Thank you so much for your help so far, you guy's really are great :rolleyes:

Posted

Nope...that didn't work either. Perhaps I'm making the file wrong? This time I did it in notebook & named it .htaccess which then turned to .htaccess.txt so I uploaded that & with my ftp program renamed it .htaccess

Posted
The 500 error is gone now but I can hotlink to the images in that subdomain.

One other thing I've come across while testing out hotlinking on my sites: make sure you clear your cache first. If you have a copy of the images in your cache, there's a chance that that's why they're showing up for you.

 

I've run myself in circles before trying to figure out why I can see my supposedly unlinkable images on other sites when all it was was a cached image.

 

So clear the cache and then reload the page to make sure for certain that the hotlinking isn't working.

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