Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 25, 2012, 01:10:54 PM

Pages: [1] 2 3   Go Down
  Print  
Author Topic: How To: Correct the issue with hotlink protection  (Read 9037 times)
Hush
Senior Moderator
Über Jedi
*****
Offline Offline

Posts: 2905


« on: November 22, 2003, 08:47:15 PM »

The Issue

Hotlink protection is undeniably a good thing.  However, when using the tool in CPanel, it will not support browsing to the domain without the trailing / mark.  That means that

Quote from: Supported Addresses


Will show your images as expected, however,

Quote from: Un-supported Addresses


will not.  At this point, I should point out that CPanel is not a Lunar Pages product, so whilst we make recommendations for updates, we are not directly able to control these updates.

To make the hotlink protection work correctly, you will need to do a small amount of editing to your .htaccess file.  No this How To: is concentrating on protecting your whole site, I will deal with protecting parts of your site in another How To: and so you will be using the .htaccess found directly inside your public_html folder today.

To make this tutorial as easy as possible we will be using the Hotlink Protection tool inside CPanel.  So start by logining into your account, and clicking on the Hotlink protection icon.  The first thing you should notice is the very large white box on the screen.  This is where you type in the URLs that you want to allow to 'Hotlink' to your site.

Simply type in the urls that you want to allow to hotlink as you would type them into a browser, for example our URLs would be typed:

Quote from: Lunar Forums Example URL


Be sure only to type in the format above, do not worry about typing addresses with and without the www. prefix, or with a page afterwards, such as index.htm, as we will take care of this soon.

Click on the 'Activate' button.  This will automatically generate the basic hotlink protection scripting for your .htaccess file, and of course put it in place.

Next step, is to go back to the CPanel (click the 'home' icon on the CPanel banner). Click on File Manager, then click on the folder icon next to public_html to enter the folder, followed by clicking on the word .htaccess.  On the right hand side of the screen, a menu will appear, click on 'edit file'.

What you should see is a screen with some lines of code as follows (I have used the lunarpages and lunarforums from above, your code will have your domain in it)

Quote from: Code Entered Into .htaccess By Hotlink Protection

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://www.luarforums.com/.*$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]


Now, here's the good bit.  I want you to change the text to include the parts below in red, so it looks like this example.

Quote from: Changes To .htaccess Codes

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


Click on the save button at the bottom of this page.  That's it, your site is now hotlink protected, and people will be able to view the site from just typing in your domain name, even without the trailing / mark.
Logged

<- From the ashes will rise a phoenix ->

Lunarpages Web Hosting || Lunarpages Forums || Lunarpages Affiliate Program
leighsww
* The Tough Love Cuddly One *
Berserker Poster
*****
Offline Offline

Posts: 13870


WWW
« Reply #1 on: November 23, 2003, 03:46:03 PM »

Excellent, Hush!  Thanks!

This REALLY was a useful tip!  I had already read another thread that you shared this info, so I had done it a few days ago, but just wanted to let you know how GREAT this tip was!
Logged
Hush
Senior Moderator
Über Jedi
*****
Offline Offline

Posts: 2905


« Reply #2 on: November 24, 2003, 06:33:47 AM »

Oh gosche...  Embarassed  Thanks.
Logged

<- From the ashes will rise a phoenix ->

Lunarpages Web Hosting || Lunarpages Forums || Lunarpages Affiliate Program
jsinger
Spaceship Captain
*****
Offline Offline

Posts: 114


« Reply #3 on: December 09, 2003, 01:43:07 PM »

I tried the hotlink protection in my .htaccess file but it doesn't seem to be working.

I have this in my .htaccess file (located in my public_html directory):
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?jeffsingerphotography.com(/)?.*$     [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ - [F,NC]

I then created the following page to test it:
http://homepage.mac.com/jhsinger/testhotlink.html

I'm still seeing the image being linked.

Jeff
Logged
Hush
Senior Moderator
Über Jedi
*****
Offline Offline

Posts: 2905


« Reply #4 on: December 09, 2003, 01:47:34 PM »

I have just visited the site you have given in your message, and the image is not showing.

I would say that this is probably cached.  Try emptying your temporary internet files/cache and reloading the page.
Logged

<- From the ashes will rise a phoenix ->

Lunarpages Web Hosting || Lunarpages Forums || Lunarpages Affiliate Program
jsinger
Spaceship Captain
*****
Offline Offline

Posts: 114


« Reply #5 on: December 09, 2003, 01:50:29 PM »

Hmmm, I cleard my cache and it was still showing up... but I did it again after a reboot now its not showing up... DOH!

Jeff
Logged
Hush
Senior Moderator
Über Jedi
*****
Offline Offline

Posts: 2905


« Reply #6 on: December 09, 2003, 01:54:21 PM »

The power of the Internet, and ghosting files  Confused

Glad it's working for you though...  Hotlink protection can be a major factor in reducing a web site's bandwidth use.
Logged

<- From the ashes will rise a phoenix ->

Lunarpages Web Hosting || Lunarpages Forums || Lunarpages Affiliate Program
jsinger
Spaceship Captain
*****
Offline Offline

Posts: 114


« Reply #7 on: December 09, 2003, 02:07:34 PM »

Yes, its of particular interest to me as a photographer.

On a related note, how does this (if at all) effect search engine spiders and how they crawl my site?
Logged
Stephanie®
Master Jedi
*****
Offline Offline

Posts: 1096



« Reply #8 on: December 09, 2003, 02:31:00 PM »

It won't affect your search engine ratings.

Most bots look for Meta tags/descriptions/keywords and links, images are not an issue.
Logged

mscnts
Spacescooter Operator
*****
Offline Offline

Posts: 42


« Reply #9 on: December 28, 2003, 05:00:10 PM »

Hello.. would you be so kind to explain exactly what 'hotlink protection' is all about?
These 'how to:' posts are great and detailed, but unless you know what you want to do and why, they don't help us green beginners... lol   It would be perfect if you could start a 'how to' with a 'what this is/does/creates' paragraph.  Much appreciated!
Logged
Hush
Senior Moderator
Über Jedi
*****
Offline Offline

Posts: 2905


« Reply #10 on: December 28, 2003, 05:30:48 PM »

Sorry,  that is an absolutely excellent point.

Hotlink Protection 101:

When you place files on your server (for instance images and video files), they can be viewed by anyone who visits your web site.  This takes up an amount of bandwidth (the size of the file).  However it is possible to link from one site to another and display files.

For instance, if you look through the graphics forum here at Lunar Forums you will see many images on display.  These images are hosted at the web site of the person who posted them.  A link to the image is added to the post in a similar way as if this forum were the person's own site.  This then takes the image from the user's site to display here.  This means that the user will have their bandwidth used for displaying the image.

This is known as hotlinking.  It can be put to great use.  However it can also be abused.  Imaging if you have a video file that is 20 MB in size, and your site gets a hundred people a day view it.  No real problem, your monthly bandwidth usage for this file will be approximately 60 GB (roughly calculated for simplicity).  However, someone sees this video and want's it on their site.  If they downloaded it, and then uploaded directly to their server to link to, it wouldn't impact your bandwidth.  However, say they are expecting 500 people to view it every day.  They may just link to the file on your server, so as not to use up their bandwidth.  Now your monthly bandwidth for this file may go up to 360 GB!

Hotlink protection stops files from being linked to, or viewed directly.  However, you are able to specify which domains are able to hotlink to your media in order that you can, for example, post images on forums.

Thanks for asking, it is all too easy to write the answer, when many people who view it will not be aware of the question.  Thumbs Up
Logged

<- From the ashes will rise a phoenix ->

Lunarpages Web Hosting || Lunarpages Forums || Lunarpages Affiliate Program
mscnts
Spacescooter Operator
*****
Offline Offline

Posts: 42


« Reply #11 on: December 28, 2003, 05:48:33 PM »

Aaaahhhhh.... *she says, nodding in complete understanding of the explanation.*   That makes perfect sense to me now!

Thanks for the quick reply!
Logged
Hush
Senior Moderator
Über Jedi
*****
Offline Offline

Posts: 2905


« Reply #12 on: December 28, 2003, 08:12:23 PM »

Very Happy  All part of the service  Thumbs Up
Logged

<- From the ashes will rise a phoenix ->

Lunarpages Web Hosting || Lunarpages Forums || Lunarpages Affiliate Program
EJ
Galactic Royalty
*****
Offline Offline

Posts: 248



« Reply #13 on: January 13, 2004, 09:42:10 AM »

Hey Hush???

heres what my says/looks like

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://www.graphics.steelsheen.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.graphics.steelsheen.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.steelsheen.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.steelsheen.com$      [NC]



Why are there "clones"? can I delete those? and which ones exactly would I delete?

edit: OK here's what it looks like now, I havent deleted those clones, Don't know if I should

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?graphics.steelsheen.com(/)?.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.graphics.steelsheen.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?steelsheen.com(/)?.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.steelsheen.com$      [NC]

Is this correct?
Logged

I love the new LPF theme
EJ
Galactic Royalty
*****
Offline Offline

Posts: 248



« Reply #14 on: January 22, 2004, 05:48:51 PM »

OK cpanel hot link sucks, sometimes it works sometimes it doesnt, my avatar was working now its not, yet oddly my pictures are still showing on other websites. I did everythng above. Everytime I update it (like adding a redirect url which doesnt work anyway!) I get 50 million clones...I give up Sad
Logged

I love the new LPF theme
Pages: [1] 2 3   Go Up
  Print  
 
Jump to: