WordPress.org

Support

Support » How-To and Troubleshooting » HELP to Prevent Hotlinking with htaccess

HELP to Prevent Hotlinking with htaccess

  • I want to prevent other sites from hotlinking from my site

    .htaccess on my server is

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    AddType Applicaions/CAB .cab

    what i want to do is each time a hot-link is done to a (cab,zip,rar,exe ) I waant the user to land on
    http://www.1800pocketpc.com/sorry-hotlinking-has-been-disabled

    and when an image (jpg/jpeg/bmp/png/gif) is hotlinked I want this image to be shown on the other site, having this image hosted on my site might not work so itys hosted on image shack
    http://img168.imageshack.us/img168/7426/hotlinkingdisabled4117djv3.jpg

    I am not sure what I have to add in to .htaccess , This is what I have come up with ( through google ) , I am not sure if this is correct though

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    AddType Applicaions/CAB .cab

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?1800pocketpc.com/.*$ [NC]
    #RewriteRule \.(gif|jpg|png|gif|bmp)$ – [F]
    #RewriteRule \.(gif|jpg|png|gif|bmp)$ http://img168.imageshack.us/img168/7426/hotlinkingdisabled4117djv3.jpg [R,L]
    #RewriteRule \.(cab|zip|rar|exe)$ – [F]
    #RewriteRule \.(cab|zip|rar|exe)$ http://www.1800pocketpc.com/sorry-hotlinking-has-been-disabled [R,L]

    can some one tell me if this is right. thanks 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘HELP to Prevent Hotlinking with htaccess’ is closed to new replies.
Skip to toolbar