WordPress.org

Ready to get started?Download WordPress

Forums

Hotlink Protection on 2.2 (6 posts)

  1. jland
    Member
    Posted 6 years ago #

    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]
  2. Roy
    Member
    Posted 6 years ago #

    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...

  3. whooami
    Member
    Posted 6 years ago #

    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.

  4. Roy
    Member
    Posted 6 years ago #

    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..........

  5. Roy
    Member
    Posted 6 years ago #

    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)?

  6. 1800pocketpc
    Member
    Posted 5 years ago #

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

    :)

Topic Closed

This topic has been closed to new replies.

About this Topic