Forum Moderators: phranque
DirectoryIndex index.php index.html index.htm
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*index\.(html?Šphp)\ HTTP/
RewriteRule ^(([^/]*/)*)index\.(html?Šphp)$ [www\.example\.com...] [R=301,L]
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ [www\.example\.com...] [R=301,L]
The above code makes my hotlink protection panel in cPanel act weird so I am just going to avoid the cPanel hotlink protection generator and just add my own code directly into .htaccess. I want to add the following code and am not sure where I should place it in my .htaccess file above. Also, is there a better code to use that will not block any image search engines and is there a suggested list of image search engines to not block?
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http(s)?://(www\.)?yourdomain.com [NC]
RewriteCond %{HTTP_REFERER}!^http(s)?://(www\.)?live.com [NC]
RewriteCond %{HTTP_REFERER}!^http(s)?://(www\.)?msn.com [NC]
RewriteCond %{HTTP_REFERER}!^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER}!^http(s)?://(www\.)?yahoo.com [NC]
RewriteRule \.(jpg¦jpeg¦png¦gif)$ - [NC,F,L]
Not knowing where your site is located, what kind of site it is, or how 'visible' or popular it is on the Web, I can't recommend any particular list of referrers to include or exclude. Keep an eye on your log files for a few weeks, and you'll soon know. Or review your past logs for image request referrers if you prefer.
Jim