Thanks but I found a better way to prevent hotlinking. From here.
http://perishablepress.com/creating-...king-strategy/
Code:
###############################
# ultimate hotlink protection #
###############################
# disable directory browsing
# uncomment this option to protect access to directories
# Options -Indexes
# enable the following of symlinks
# uncomment this option if hotlink protection fails to work
# Options +FollowSymLinks
# verify presence of mod rewrite
<IfModule mod_rewrite.c>
# enable the rewrite engine
RewriteEngine on
# check that file exists
RewriteCond %{REQUEST_FILENAME} -f
# check for requested file types
# include additional file types here
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g?|png)$ [NC]
# allow blank referrer requests
RewriteCond %{HTTP_REFERER} !^$
# allow all requests from your domain
# edit the domain to match your own
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?domain\. [NC]
# allow all requests from your ip address
# edit the ip address to match your own
RewriteCond %{HTTP_REFERER} !^https?://123\.123\.123\.123(.*)$ [NC]
# additional site access
# include additional sites here replace domain names and or
# remove unnecessary lines or add new lines for more sites
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?domain_01\. [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?domain_02\. [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?domain_03\. [NC]
# search engine access
# include or remove search engines feed readers and other sites
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
# allow access to all requests for your anti hotlink image
# to serve an image instead of delivering a 403 error
# uncomment the next line and edit the path and file name
# RewriteCond %{REQUEST_URI} !^/hotlink\.jpg$ [NC]
# deliver the hotlink image for all requests for the listed files
# protect additional file types by editing the list below
# if you are serving a file instead of a 403
# uncomment the next line and edit the path and file name
# RewriteRule \.(gif|jpe?g?|png)$ http://domain.tld/hotlink.jpg [R,NC,L]
# return a 403 error when any of the following file types is requested
# you can protect additional file types by editing the list below
RewriteRule \.(gif|jpe?g?|png)$ - [F,NC,L]
# close the module container
</ifModule>