{REQUEST_URI} trouble

Hi guys!
One of my clients is hosted here and we have unique trouble with his mod_rewrite. He had these string in htaccess and they worked fine:

RewriteCond %{HTTP_REFERER} ^http://.refererdomain.com. [NC]
RewriteRule ^.* http://www.targetdomain.com [R,L]

But after adding one more condition:

RewriteCond %{HTTP_REFERER} ^http://.refererdomain.com. [NC]
RewriteCond %{REQUEST_URI} !^.*jpg|.gif [NC]
RewriteRule ^.
http://www.targetdomain.com [R,L]

this new condition doesn’t work however it works on all other hostings normally(doesn’t redirect requests to images) and rule acts just as before(redirect all requests).
Can you tell me what’s wrong with it or repair your mod_rewrite please.

The regular expression is really bad form. To answer your question, this is what is wrong with it:

  1. Meaningless to match ^.*
  2. Meaningless to match .|.
  3. Alternate substrings not delimited using parentheses.

Also, don’t forget that . matches any character. This means the period in a domain needs to be escaped, so that example.com becomes example.com

The Perl documentation describes the use of regular expressions here:

When the expression is re-written properly, it works.

:cool: Perl / MySQL / HTML CSS

That’s just rather strange anyway because this redirect works normally on many of my domains.