Wordpress .htaccess Issue

Discussion in 'Apache' started by PPCInformer, Jul 2, 2008.

  1. #1
    Hi fellas

    I want to prevent other sites from hotlinking from my site ( self hosted wordpress )

    .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 
    Code (markup):
    what i want to do is each time a hot-link is done to a (cab,zip,rar,exe ) I want 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)$ [URL]http://img168.imageshack.us/img168/7426/hotlinkingdisabled4117djv3.jpg[/URL] [R,L]
    RewriteRule \.(cab|zip|rar|exe)$ - [F]
    RewriteRule \.(cab|zip|rar|exe)$ [URL]http://www.1800pocketpc.com/sorry-hotlinking-has-been-disabled[/URL] [R,L] 
    Code (markup):
    I tried this on my server , it dint work , others could still hotlink my images
     
    PPCInformer, Jul 2, 2008 IP