Thread: .htaccess help

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Jenks, Oklahoma, United States
    Posts
    7
    Rep Power
    0
    I'm trying to use the .htaccess file to protect the directory I use for all of my images on my site. It allows only sites that I specify within it to link off of graphics from my site. The code is as follows:

    # Rewrite Rule for images
    RewriteCond %{HTTP_REFERER} http://www.htmletc.net/
    RewriteRule ^(.*)$ http://www.htmletc.net/

    For example. And when linked off of other sites that I do not specify within .htaccess it works great, not allowing the image that is linked off my site to be shown on the other site. When I view my main site w/ Netscape (my main site is specified to allow to link off of the images), everything is great. But when I view it w/ IE, none of images appear. Any ideas or help would be greatly appreciated.
  2. #2
  3. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    Have you tried -> http://www.apache.org/docs/misc/rewriteguide.html ?


    Per your example, I would do something like this:


    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://www.htmletc.net/.*$ [NC]
    RewriteRule .*.gif$ - [F]
    RewriteRule .*.jpe?g$ - [F]

    I don't see your RewriteRule trying to block anything without the [F].

    [This message has been edited by freebsd (edited September 04, 2000).]
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Jenks, Oklahoma, United States
    Posts
    7
    Rep Power
    0
    Thanks, I'll look at that and put it into effect to see if I can get it to work correctly. You're help is much appreciated.



  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    3
    Rep Power
    0
    I tried editing this code and using it myself. I have a serious problem of people pirating media clips on my site. It adds a lot of traffic from which other sites get the visitors.

    Do I just put it into my media folder in an .htaccess file? In the above example, I just put my url in and dropped the htaccess file in my images dir. I was able to continue pirating stuff.

    Anything to add for a desperate person?
  8. #5
  9. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    Put that .htaccess in your media directory to avoid unneccessary server load. If you place it in your docroot dir, the .htaccess file will be read for any requests of your site.

IMN logo majestic logo threadwatch logo seochat tools logo