Successfully adding Anti Hot linking code
-
I have been trying to get the following code to work with no success:
# anti-hotlinking
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https://www.mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https://mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteCond %{HTTP_REFERER} !search\/cache [NC]
RewriteCond %{HTTP_REFERER} !cache [NC]RewriteRule .*\.(jpg|JPG)$ https://www.mysite.com/images/hotlinked-image.jpg [R,NC]
Should I add this to my root .htaccess file, and if so can I add it just like this at the end after this code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>Or do I have to add the <ifmodule mod rewrite.c> around the hotlinking code? or add # BEGIN or # END
also, there are .htccess in wp-content and wp-admin. Should the code go to any of these other places?
- The topic ‘Successfully adding Anti Hot linking code’ is closed to new replies.