• I placed a htaccess file in each of my image folders in my blog to try to stop people hotlinking the images. This was the rule that I used:

    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^https://(www\.)?yoursite\.com/dir/ [NC
    RewriteCond %{HTTP_REFERER} !^$
    RewriteRule \.(jpe?g|gif|bmp|png)$ images/nohotlink.jpg [L]

    The problem with this was that it completely stopped the images from showing up on my blog. Please can someone tell me if this was the incorrect rule to use or point me in the right direction. Thanks for your time I do appreciate it as I am totally new to this particular sort of thing. Cheers,

    Mike

Viewing 9 replies - 1 through 9 (of 9 total)
  • Did you change yoursite to your respective domain name?

    Thread Starter gazeuk

    (@gazeuk)

    Yes I did all that but the images just wouldnt show up till i removed the file.

    Mike

    There appear to be five lines of code, is that third line the end of the second line? Is it meant to be [NC or [NC]? Where did you get this code from?

    Thread Starter gazeuk

    (@gazeuk)

    looking at the code is just meant to be [NC

    I got it from this post:

    https://www.ads-software.com/support/topic/28085?replies=16

    hope this helps.

    and thanks again for the help.

    Mike

    You need the closing square bracket. I use this in my .htaccess file (above the WordPress part):

    # PREVENT image hotlinking
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^https://www.mydomain.com/ [NC]
    RewriteCond %{HTTP_REFERER} !google. [NC]
    RewriteCond %{HTTP_REFERER} !search?q=cache [NC]
    RewriteCond %{HTTP_REFERER} !yahoo. [NC]
    RewriteRule .(jpg|gif|png)$ - [F]
    #

    It seems to work okay.

    That’s interesting, because when I load the code from the link you provided it’s definitely [NC]

    close the [NC with the bracket, like so: [NC] it will work.

    Bad pastes happen. So do bad eyes. No big deal.

    Thread Starter gazeuk

    (@gazeuk)

    Thank you for that everybody. It’s been a great help and I sure do appreciate it. Cheers

    Mike

    Thread Starter gazeuk

    (@gazeuk)

    Thats done it guys. Many many thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘htaccess Question’ is closed to new replies.