Prevent hotlinking with htaccess doesn't work

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hausarzt
    Confirmed User
    • Jan 2011
    • 818

    #1

    Prevent hotlinking with htaccess doesn't work

    Hey guys.
    A bunch of sites hotlink my media, so I wanted to prevent it with some htaccess code.
    I use wordpress, so there is a bunch of other stuff in the file. I only post the stuff I added:

    Code:
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?website1\.com(/.*)*$ [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?website2\.com(/.*)*$ [NC,OR]
    RewriteCond %{HTTP_REFERER} ^http://(www\.)?website3\.com(/.*)*$ [NC,OR]
    RewriteRule \.(jpeg|JPEG|jpe|JPE|jpg|JPG|gif|GIF|png|PNG|mng|MNG)$ - [F]
    Somehow this does not work, as the media is still present on the external sites. What's wrong with my code?
    I know, my english is bad. But your german might be even worse
  • bugmenot4real
    Confirmed User
    • Jun 2013
    • 184

    #2
    cache? maybe?

    Comment

    • doeser
      Confirmed User
      • Jun 2001
      • 205

      #3
      nginx maybe?

      Comment

      • JesseQuinn
        feeding the wolves
        • Aug 2012
        • 6633

        #4
        Originally posted by hausarzt
        Hey guys.
        A bunch of sites hotlink my media, so I wanted to prevent it with some htaccess code.
        I use wordpress, so there is a bunch of other stuff in the file. I only post the stuff I added:

        Code:
        RewriteEngine On
        RewriteCond %{HTTP_REFERER} ^http://(www\.)?website1\.com(/.*)*$ [NC,OR]
        RewriteCond %{HTTP_REFERER} ^http://(www\.)?website2\.com(/.*)*$ [NC,OR]
        RewriteCond %{HTTP_REFERER} ^http://(www\.)?website3\.com(/.*)*$ [NC,OR]
        RewriteRule \.(jpeg|JPEG|jpe|JPE|jpg|JPG|gif|GIF|png|PNG|mng|MNG)$ - [F]
        Somehow this does not work, as the media is still present on the external sites. What's wrong with my code?
        dunno about the code but since you're on wp you can use the WP Security plugin to block hotlinking pretty easily

        hope that helps
        throwing molotav cocktails at the precinct

        Comment

        • Major (Tom)
          So Fucking Banned
          • Nov 2003
          • 32492

          #5
          Link Hotten!

          Comment

          • Freedom6995
            Friends of Venus founder
            • Jul 2010
            • 1975

            #6
            https perhaps instead of http?

            Comment

            • plsureking
              bored
              • Aug 2003
              • 4908

              #7
              more of a !not instead of do. i dont think you want to update your htaccess every time a new asshole starts hotlinking. if the ref is NOT your site, redirect.

              https://help.dreamhost.com/hc/en-us/...ge-hotlinking-

              and watch those mng files

              #
              PornCMS / low cost paysite management with hosting

              Comment

              Working...