Wanted - Script To Prevent Hot-Linking To Images On FrontPage Site

by Lainie
7 replies
Hi,

The hot-linking to product images on my site is getting beyond a joke now.

Can anyone help by advising me how to stop this sneaky practice on a Microsoft FrontPage site?


I found this on a Frontpage forum dated 2003

Let me start by telling you how to make an .htaccess file and where to put it. Simply open a text editor and paste the code below. Remember to make the proper changes to it so that it will work on your site and will send traffic to your Full Page Ad. Once you have made the changes, save this file as .htaccess. Now, upload this file to your public directory and your are good to go.

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


I don't want to send them to a full page ad, just stop the hot-linking so how do I change the last line of code?

When they say save as a .htaccess file does anything go in front of the '.'

Sorry to be so thick but I don't understand these rewrite codes.

Thanks for your help

Lainie
#frontpage #hotlinking #images #prevent #script #site #wanted
  • Profile picture of the author gcornelisse
    Lainie,

    You'll want to make sure that your hosting provider is using the Apache web server before .htaccess files will work. Typically, Frontpage websites us Microsoft IIS web server, although not all the time.

    If you're hosted using Apache, then yes, an .htaccess might be your answer. And, no, there is nothing you have to put in front of the "." in ".htaccess"

    Gary
    {{ DiscussionBoard.errors[614210].message }}
    • Profile picture of the author Lainie
      Thanks for the help Gary,

      I've just found out my web host has .htaccess files disabled so I can't use one. Wish I'd looked before I wasted a whole afternoon on it.

      I've looked into PHP as an alternative but it all looks so confusing.

      Any advice on PHP would be appreciated.

      Thanks

      Lainie
      {{ DiscussionBoard.errors[615284].message }}
  • Profile picture of the author gcornelisse
    Lainie, I have little PHP script for you that will probably work. I'd post it here, but for some reason the WF doesn't like it when I try to include it's code in my reply. I used to know why, but I can't remember right now. If you PM your email address to me I'll send it as an attachment.

    Gary
    {{ DiscussionBoard.errors[615387].message }}
  • Profile picture of the author wayfarer
    As far as I know, that must be done from Apache. Sometimes your host will provide a means of controlling this, so look in the control panel I guess.

    Hosts without .htaccess access are horrible (***cough *** Yahoo! ***cough***).
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[615389].message }}
  • Profile picture of the author gcornelisse
    You can do it with PHP. You just have to pass the file through a PHP readfile or file_get_contents after you've compared HTTP_REFERER and SERVER_NAME. Its not the most efficient thing to do, but for your average website its not likely to cause a problem.
    {{ DiscussionBoard.errors[615398].message }}
  • Profile picture of the author gcornelisse
    Lainie, how did you make out with that script I sent?
    {{ DiscussionBoard.errors[617450].message }}
    • Profile picture of the author Karen Blundell
      if your hosting provides you with cPanel, there is an option right in your cPanel for hotlink protection. no script needed...cPanel's HotLink Protection writes to the .htaccess file for you

      this is one of the reasons you should really do your research before you spend money on hosting or use the free host route.
      Signature
      ---------------
      {{ DiscussionBoard.errors[621349].message }}

Trending Topics