Forum Moderators: phranque

Message Too Old, No Replies

301 Redirect in .htaccess is Changing my Cpanel Hotlink Protection

         

riospace

7:04 pm on Oct 19, 2006 (gmt 0)

10+ Year Member



I hope this is the right place to ask this question.

I have added the following code to my .htaccess:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ [domain.com...] [R=301,L]

When I add this code it messes up my Cpanel hotlink protection that I have enabled. If I fix the Cpanel hotlink protection then the code above gets changed and does not work properly.

Why is this happening and how do I fix this? I am having a huge problem with hotlinking.

g1smd

7:12 pm on Oct 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You didn't show the hotlinking code, but this new hotlinking code should fix things:

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mymaindomain\.(com¦co\.uk)/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?myotherdomain\.(com¦co\.uk)/.*$ [NC]
RewriteRule \.(gif¦jpg¦jpeg¦png)$ - [F,NC]

The above code assumes four domain names; two names and both of those with both .com and .co.uk used. It protects for both www and non-www too.