• abhideydas

    (@abhideydas)


    I added some code for hotlinking protection in my .htaccess file and it messed up my WP permalink structure so I had to remove it. Is there a way to prevent hotlinking with .htaccess along with preventing WP from crashing.

Viewing 5 replies - 1 through 5 (of 5 total)
  • whooami

    (@whooami)

    yes, add the code to your .htaccess in the proper manner.
    I use hotlink protection successfully and have no trouble, as do others, im sure.

    anything added to your .htaccess needs to go outside this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    ....
    </IfModule>
    # END WordPress

    the above is specifically calling Apache’s mod_rewrite module

    projectego

    (@projectego)

    whooami, would you mind sharing the code you used for hotlink protection please?

    whooami

    (@whooami)

    sure,

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} .(gif|jpeg|jpg|png|swf)$ [NC]
    RewriteCond %{HTTP_REFERER} !^$ [NC]
    RewriteCond %{HTTP_REFERER} !village-idiot.org [NC]
    RewriteCond %{HTTP_REFERER} !google. [NC]
    RewriteCond %{HTTP_REFERER} !bloglines. [NC]
    RewriteCond %{HTTP_REFERER} !feedburner. [NC]
    RewriteCond %{HTTP_REFERER} !search?q=cache [NC]
    RewriteRule (.*) https://www.someotherevilsite.com/otherimage.png

    This is what protects *some* of my files. Note, that I send hotlinkers off to another site completely. I tend to chose the most obnoxious images I can find.

    what usually happens… some unsuspecting flub comes along, sees a cool image, goes back to some forum and posts it…. minutes later a moderator has removed the picture because its SO offensive. The funny thing is because the image is cached, the original hotlinker doesnt see what everyone else does, so they never get it.

    I hate hotlinkers.

    It is arguable that I am doing the same thing with my redirect. However, because I choose images that are horribly offensive to most people, they dont last long on most sites.

    prjg

    (@iiiiiiiv)

    Put the above rule in your doc_root too, not your /blog install, that way it captures everything. Works like a charm.
    Rather than redirect to another site, my 403 page has a few choice words on it re: freeloading ??

    My code, jsut for comparison’s sake:

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^https://(www\.)?ulujain\.org [NC]
    RewriteCond %{HTTP_REFERER} !google\. [NC]
    RewriteCond %(HTTP_REFERER) !yahoo\. [NC]
    RewriteCond %(HTTP_REFERER) !altavista\. [NC]
    RewriteCond %{HTTP_REFERER} !alltheweb\. [NC]
    RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
    RewriteCond %{HTTP_REFERER} ^https:// [NC]
    RewriteCond %{HTTP_REFERER} !^$
    RewriteRule \.(jpe?g|gif|png)$ – [F]

    Thread Starter abhideydas

    (@abhideydas)

    works like a charm. thanks for your help ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WP and Hot Linking protection’ is closed to new replies.