0

The rule below worked on all our sites for 5 years under ISAPI_Rewrite2 on Windows 2008 Server 64 bit on IIS7.5

# Rewrite the domain to begin with so always have www. prefix for SSL
RewriteCond Host: ([^.]+\.com.au) 
RewriteRule (.*) http\://www\.$1$2 [I,RP]

Recently we have move to Windows Server 2012 running IIS8.0 and we get HTTP errors on the site when this condition is run. The site works fine if accessed via http://www.domain.com, but when run as domain.com without the "www" it throws an exception?

Is there anything I can do to get this working under IIS8 / Win 2012?

Thanks

Phil Rasmussen
  • 635
  • 1
  • 7
  • 20

1 Answers1

0

Can you try this rule with negative lookahead regex:

RewriteCond Host: (?!www\.)([^.]+\.com\.au) 
RewriteRule (.*) http\://www.$1$2 [I,RP]
anubhava
  • 761,203
  • 64
  • 569
  • 643
  • Unfortunately no errors are being logged just a blank screen when i visit the site. If i comment out this rule the site is fine and all other rules work as normal. – Phil Rasmussen Oct 28 '13 at 11:04