Hi all, Long story short: I would love it if someone would be so kind as to help provide me with the necessary code for my .htaccess file to prevent people from hotlinking my images from my Coppermine Photo Gallery installation. I have looked everywhere for the right code and either cannot get it to work or I have to sacrifice something else for it in return. I have my gallery located here: Devil May Cry Gallery Basically I want any images located there to kept safe and sound from hotlinking. I would also like for my homepage (Devil May Cry) and forums directory (Devil May Cry Forum) to be able to link images from my gallery - so if possible I would like them added to a 'whitelist' of sorts. Here is my current .htaccess file if that helps: ## ******************************************** ## Coppermine Photo Gallery ## ************************ ## Copyright (c) 2003-2006 Coppermine Dev Team ## v1.1 originaly written by Gregory DEMAR ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ******************************************** ## Coppermine version: 1.4.10 ## $Source$ ## $Revision: 3275 $ ## $Author: gaugau $ ## $Date: 2006-09-03 12:10:47 +0200 (So, 03 Sep 2006) $ ## ******************************************** Options FollowSymLinks SymLinksIfOwnerMatch RewriteEngine on # Uncomment the following line if your webserver's # URL is not directly related to physical file paths. # Update "YOUR_COPPERMINE_ROOT" (just / for root) #RewriteBase /YOUR_COPPERMINE_ROOT # # Rewrite index urls # RewriteRule index-([0-9]*)\.html index.php?cat=$1 [NC] RewriteRule index-([0-9]*)-page-([0-9]*)\.html index.php?cat=$1&page=$2 [NC] # # Rewrite thumbnail urls # RewriteRule thumbnails-([a-z0-9]*)-([\-]?[0-9]*)\.html thumbnails.php?album=$1&cat=$2 [NC] RewriteRule thumbnails-([a-z0-9]*)-page-([0-9]*)\.html thumbnails.php?album=$1&page=$2 [NC] RewriteRule thumbnails-([a-z0-9]*)-([\-]?[0-9]*)-page-([0-9]*)\.html thumbnails.php?album=$1&cat=$2&page=$3 [NC] RewriteRule thumbnails-([0-9a-z]*)\.html thumbnails.php?album=$1 [NC] RewriteRule thumbnails-search-(.*)\.html thumbnails-search-$1 [NC] # # Rewrite displayimage urls # RewriteRule displayimage-([a-z0-9]+)-([\-]?[0-9]+)-([\-]?[0-9]+)\.html displayimage.php?album=$1&cat=$2&pos=$3 [NC] RewriteRule displayimage-([a-z0-9]+)-([\-]?[0-9]+)\.html displayimage.php?album=$1&pos=$2 [NC] RewriteRule displayimage-([0-9]+)\.html displayimage.php?pos=-$1 [NC] RewriteRule slideshow-([0-9]+)-([\-]?[0-9]+)-([0-9]+)\.html displayimage.php?album=$1&pid=$2&slideshow=$3 [NC] RewriteRule slideshow-([a-z]+)-([\-]?[0-9]+)-([0-9]+)-([0-9]+)\.html displayimage.php?album=$1&cat=$2&pid=$3&slideshow=$4 [NC] <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^gallery.devilmaycry\.org [NC] RewriteRule ^(.*)$ http://gallery.devilmaycry.org/$1 [L,R=301] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ RewriteRule ^index\.php$ http://gallery.devilmaycry.org/ [R=301,L] </IfModule> ErrorDocument 404 http://gallery.devilmaycry.org/404.php Redirect 301 /index.php?cat=2 http://gallery.devilmaycry.org/index-2.html Redirect 301 /index.php?cat=3 http://gallery.devilmaycry.org/index-3.html Redirect 301 /index.php?cat=4 http://gallery.devilmaycry.org/index-4.html Redirect 301 /index.php?cat=5 http://gallery.devilmaycry.org/index-5.html Code (markup): I desperately, desperately need your help on this guys; I hate to see my precious bandwidth being gobbled up by others. Major green reppage to anyone who is kind enough to help. Thank you in advance. Regards, Steve
Hi read all about it here http://www.devpapers.com/article/242 simply put it after rewrite engine on before all your other stuff. RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com(/)?.*$ [NC] RewriteRule .*\.(gif|jpe?g|png|bmp)$ [F,NC] Or use the next bit of code to put a "nice" pic on the other site..... Best of luck Expat