Dangling RewriteCond?

Topics: User Forum
Dec 7, 2006 at 6:35 PM
I'm hoping someone can help with this issue we're having.

We have an IIS website that has multiple domains pointed to its IP address. The purpose of the website is to act as a centralized redirector for our website domain properties and how we would handle foo.com vs. www.foo.com.

Here is how we have the rewritecond and rewriterules we have in the INI file:
RewriteCond %{HTTP_HOST} ^foo\.com$
RewriteRule ^/$ http://www.foo.com/here/ I,R=301

RewriteCond %{HTTP_HOST} ^goo\.com$
RewriteRule ^/$ http://www.goo.com I,R=301

This is what we're seeing in the resulting log file (I've stripped out the timestamps):
ini line 61: RewriteCond %{HTTP_HOST} ^foo\.com
ini line 62: RewriteRule 1 ^/$ http://www.foo.com/here/ I,R=301
ParseModifierFlags: 'I,R=301'
ini line 64: RewriteCond %{HTTP_HOST} ^goo\.com
ini line 65: RewriteRule 2 ^/$ http://www.goo.com I,R=301
ini file line 65: duplicate expression '^/$'
Done reading .ini file: Found 1 rules (0 failed) on 77 lines
WARNING: Dangling RewriteCond found in ini file
- New Url: '/'
- ApplyRules (depth=0)
- Rule 1 : 1
- Condition: checking 'foo.com' against pattern '^foo\.com'
- Condition true, Rule applies (rc=0)
- Result (length 39): http://www.foo.com/here/
- ApplyRules: returning 301
- Redirect (code=301) Url to: 'http://www.foo.com/here/'
- DoRewrites
- New Url: '/'
- ApplyRules (depth=0)
- Rule 1 : 1
- Condition: checking 'goo.com' against pattern '^foo\.com'
- Condition false, Rule does not apply (rc=-1)
- ApplyRules: returning 0
- No Rewrite

What's a "dangling RewriteCond" and how do I undangle it?

Why is it seeing a duplicate expression even though I have a separate RewriteCond to handle "goo.com"?

Help, please.

Thanks in advance.

Dec 14, 2006 at 10:46 PM
"Dangling RewriteCond" means there is a RewriteCond in your ini file with no RewriteRule associated to it.

In a prior version of IIRF, the logic for testing uniqueness of a rule examined only the RewriteRule pattern, and not the set of RewriteCond's that may have been attached to the pattern. So IIRF is (incorrectly) flagging your two RewriteRules as the same, even though they have different conditions.

This bug was fixed in 1.2.10
(which is currently labeled the latest stable build on
http://cheeso.members.winisp.net/IIRF.aspx )

I suggest you get that version?