WordPress.org

Support

Support » How-To and Troubleshooting » Hotlink Protection on 2.2

Hotlink Protection on 2.2

  • I figured it out!

    A while ago when I tried the hotlink protection on cpanel, it broke my wordpress. When I did a search on here, none of the tips helped, so I decided to approach this by trial and error instead.

    I’m not exactly sure how .htaccess works, and I don’t know what all the little symbols mean, but now I have hotlink protection AND pretty permalinks (category/post)

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    RewriteCond %{HTTP_REFERER} !^http://domain.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://domain.com$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.domain.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.domain.com$      [NC]
    RewriteRule \.(gif|jpg)$ - [F]
Viewing 5 replies - 1 through 5 (of 5 total)
  • Roy
    Member

    @gangleri

    Arg, this one doesn’t work for me either…
    When I put a htaccess in my images folder, my own site is no longer allowed to show images either and I don’t see why. (Of course I changed “domain.com” by my own domain name.) I have tried numerous similar htaccess examples, but all have the same result. I thought that it might be WP, but judging jland’s story, this is not the case…

    RewriteCond %{REQUEST_FILENAME} \.(gif|jpeg|jpg|png|swf)$ [NC]
    RewriteCond %{HTTP_REFERER} !^$ [NC]
    RewriteCond %{HTTP_REFERER} !mydomain\.com [NC]
    RewriteCond %{HTTP_REFERER} !google\. [NC]
    RewriteCond %{HTTP_REFERER} !whoovi [NC]
    RewriteCond %{HTTP_REFERER} !b2evolution\. [NC]
    RewriteCond %{HTTP_REFERER} !bloglines\. [NC]
    RewriteCond %{HTTP_REFERER} !feedburner\. [NC]
    RewriteCond %{HTTP_REFERER} !wordpress\. [NC]
    RewriteCond %{HTTP_REFERER} !live\.com [NC]
    RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
    RewriteRule .* - [F]

    the above, in an .htaccess, that lives in a directory with images in it will block all hotlinking from sites that arent mentioned in the rules above.

    Ive used it for years, and other people have also used variations of it successfully.

    It has nothing to do with wordpress.

    Roy
    Member

    @gangleri

    Also this one blocks my own website… What do I do wrong with this line?:
    RewriteCond %{HTTP_REFERER} !gangleri\.nl [NC]

    This thing may be, that I have five folders with each a WP database. The one I am fooling around with is /musicreviews and the folder /musicreviews/afbeeldingen. I have tried a few variations and a few places to put the htaccess file (the most logical place to me seems the “afbeeldingen” folder). When I put the htaccess in the root of the website, nothing works and I fear a little to put the thing in a folder that WP uses……….

    Roy
    Member

    @gangleri

    Nope, every htaccess file that I tried so far either doesn’t do the trick or completely wrecks the website. I ran into a Hotlinking Protection plugin, but also this one doesn’t do what it promises (for me at least). Could my problem be the subfolders/subsites and/or the folder in which I put my images (directly after the ‘root’ of each subsite, so example.com/wordpresssite1/images)?

    Saijo George
    Participant

    @1800pocketpc

    I started using watermark on the images when its hotlinked , its fine now , thanks for your help.

    🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hotlink Protection on 2.2’ is closed to new replies.