Unexpected behaviour: "duplicate rules" despite different RewriteCond

Topics: User Forum
Jan 30, 2013 at 10:59 AM

I'm trying to use a single IIS website to configure redirects for multiple legacy websites, using the %{HTTP_HOST} variable to set RewriteConds that filter which set of rules to run.

Here's an excerpt of the IIRF.ini file:

 

RewriteEngine ON
StatusInquiry ON
IterationLimit 5

RewriteCond %{HTTP_HOST} test\.discovery\.nationalarchives\.gov\.uk [I]
RedirectRule ^.*$        http://www.nationalarchives.gov.uk/discovery/closed.asp  [I,R=302]

RewriteCond %{HTTP_HOST} test\.learningcurve\.pro\.gov\.uk [I]
RedirectRule ^/(?!robots\.txt$).*$        http://www.nationalarchives.gov.uk/education/  [I,R=301]
RewriteRule ^/robots\.txt$ /disallow-all-robots.txt [I,L]

RewriteCond %{HTTP_HOST} test\.hospitalrecords\.pro\.gov\.uk [I]
RedirectRule ^/(?!robots\.txt$).*$        http://www.nationalarchives.gov.uk/hospitalrecords/  [I,R=301]
RewriteRule ^/robots\.txt$ /disallow-all-robots.txt [I,L]

RewriteCond %{HTTP_HOST} test\.familyrecords\.gov\.uk [I]
RedirectRule ^/(?!robots\.txt$).*$        http://www.nationalarchives.gov.uk/frc/familyrecords.htm  [I,R=301]
RewriteRule ^/robots\.txt$ /disallow-all-robots.txt [I,L]

RewriteCond %{HTTP_HOST} test\.learningcurve\.gov\.uk [I]
RedirectRule ^/archivedgreatwar.*$    http://www.nationalarchives.gov.uk/education/greatwar/default.htm    [I,R=301]
RedirectRule ^/britain1906to1918(.*)$    http://www.nationalarchives.gov.uk/education/britain1906to1918$1    [I,R=301]
RedirectRule ^/.*$    http://www.nationalarchives.gov.uk/education/    [I,R=301]

RewriteCond %{HTTP_HOST} test\.pro\.gov\.uk [I]
RedirectRule ^/about/foi\.htm$    http://www.nationalarchives.gov.uk/foi/default.htm    [I,R=301]
RedirectRule ^/about/preservation/digital/collaboration\.htm$    http://www.nationalarchives.gov.uk/information-management/projects-and-work/research-collaboration.htm    [I,R=301]
RedirectRule ^/.*$    http://www.nationalarchives.gov.uk/default.htm    [I,R=301]

According to the log, IIRF considers all but the first instance of "RewriteRule ^/robots\.txt$ /disallow-all-robots.txt [I,L]" as duplicates and ignores them.  However, each rule is subject to a different RewriteCond condition, so they aren't really duplicates if they were evaluated fully.

Also, if I test the above configuration with the URL "test.pro.gov.uk", the ^/.*$ rule for the test.learningcurve.gov.uk site is matched and executed without evaluating the associated RewriteCond condition.

Am I trying to do something that is not possible with IIRF?