We help IT Professionals succeed at work.
Get Started

Apache .htaccess Hot Link Blocking Code

677 Views
Last Modified: 2013-12-08
Experts,

I moved some domains from one registrar to another, and after the move, my .htaccess rewrite code is not working as it was before the registrar move.

The domains are being hosted on the same server before and after the registrar move.  Nothing has changed except the registrar move.  No files were moved or modified, etc.

The rewrite code prevents hot-linking to certain file types on the site ... here's the code:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com/.*$ [NC]
RewriteRule .*\.(gif|jpg|swf|dcr|txt|php|js|css)$ - [F]

Here's the problem:

When accessing the site using IE6 with URL: http://www.domain.com
the site is rendered without formatting -- i.e. the CSS is not loaded properly.

But when accessing the site using IE6 with URL: http://domain.com
the site is rendered correctly -- i.e. the CSS loads properly.

Strangely, FF3 renders the site correctly with both URL variants.

Removing the .htaccess hot-link blocking code, makes the IE6 problem go away.

I viewed the site with IE6 from different computers and different ISPs, just in case the problem was related to a single computer or ISP ... but the problem occurs in all tests.

To see if the problem was limited to just one domain, I tested all the transferred domains. The problem occurs on all transferred domains that contain the hot-link blocking code in .htaccess -- removing .htaccess makes the problem disappear.

Any ideas what may be causing this?

Thanks.
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE