Forum Moderators: phranque

Message Too Old, No Replies

htaccess prevents hotlinking, but may also prevent legitimate access

RewriteCond %{HTTP_REFERER} !^http://(www\.)?myDomain.com/.*$ [NC]

         

zollerwagner

4:57 am on Oct 25, 2003 (gmt 0)

10+ Year Member



Recently, a contact has told me that they can't see the navigation bar images in one of my sites if they input: www.myDomain.com (without the slash), but can see the images if they input: www.myDomain.com/ (with the slash). They are supposedly using a PC with Internet Explorer.

Unfortunately, I can't replicate this problem on any of the computers I've tried, even after clearing the cache--so I'm working in the dark on this one.

In my htaccess files, I currently have:

# do not allow indexes
Options +FollowSymLinks -Indexes

RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?myDomain.com/.*$ [NC]

RewriteCond %{HTTP_REFERER}!^http://216\.239\.(3[2-9]¦[45][0-9]¦6[0-3]).*(www\.)?myDomain\.com [NC]
RewriteCond %{HTTP_REFERER}!^http://babel.altavista.com/.*(www\.)?myDomain\.com [NC]
RewriteCond %{HTTP_REFERER}!^http://216\.243\.113\.1/cgi/
RewriteCond %{HTTP_REFERER}!^http://search.*\.cometsystems\.com/search.*(www\.)?myDomain\.com [NC]
RewriteCond %{HTTP_REFERER}!^http://.*searchhippo\.com.*(www\.)?myDomain\.com [NC]

RewriteRule \.(gif¦jpg¦jpeg?¦png)$ - [NC,F]

I'm thinking I should try removing the "/.*$" at the end of:

RewriteCond %{HTTP_REFERER}!^http://(www\.)?myDomain.com/.*$ [NC]

Does that make sense?

What does the "/.*$" at the end of that line actually do?

I'm guessing it says: "any character (the period), any number of them (the *) at/to the end of the string (the $). If so, then that seems unnecessary and could be the culprit.

Do I have to worry about causing other problems if I remove the "/.*$"?

jdMorgan

5:12 am on Oct 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



zollerwagner,

> that seems unnecessary and could be the culprit.

Yes, remove the "/.*$"

In regular expressions, ".*$" is always redundant, as is "^.*" - you can omit them.

I don't foresee any problems, because that's what I use on my sites.

Jim

zollerwagner

5:30 am on Oct 25, 2003 (gmt 0)

10+ Year Member



Thanks!