Working redirect rule:
<system.webServer><rewrite><rules><rule name="www.ccesd.eu redirect" stopProcessing="true"><match url=".*" /><conditions><add input="{HTTP_HOST}" pattern="^www\.ccesd\.eu$" /></conditions><action type="Redirect" url="http://www.ccesd.ac.uk/BritSocAt/{R:0}" logRewrittenUrl="true" redirectType="Temporary" /></rule></rules></rewrite></system.webServer>
Failing rewrite rule (gives 404 error for all URLs, even just http://www.ccesd.eu):
<system.webServer><rewrite><rules><rule name="www.ccesd.eu rewrite" stopProcessing="true"><match url=".*" /><conditions><add input="{HTTP_HOST}" pattern="^www\.ccesd\.eu$" /></conditions><action type="Rewrite" url="http://www.ccesd.ac.uk/BritSocAt/{R:0}" logRewrittenUrl="true" /></rule></rules></rewrite></system.webServer>
In IIS7.5 I have a top-level web-site named CCESD; this contains various application directories (as opposed to virtual directories), one of which is /BritSocAt. I have two bindings for the CCESD site, both on port 80:
The relevant details from the applicationHost.config file are as follows:
<configuration><system.applicationHost><applicationPools><add name="BritSocAt" managedRuntimeVersion="v4.0" /><add name="CCESD" managedRuntimeVersion="v4.0"><processModel idleTimeout="1.09:20:00" /><recycling><periodicRestart time="2.18:40:00" /></recycling></add><applicationPoolDefaults><processModel identityType="ApplicationPoolIdentity" /></applicationPoolDefaults></applicationPools><sites><site name="CCESD" id="5" serverAutoStart="true"><application path="/" applicationPool="CCESD"></application><application path="/BritSocAt" applicationPool="BritSocAt"><virtualDirectory path="/" physicalPath="C:\Websites\CCESD\BritSocAt" /><virtualDirectory path="/CommonControls" physicalPath="C:\Websites\CCESD\CommonControls" /></application><bindings><binding protocol="http" bindingInformation="140.97.30.19:80:www.ccesd.ac.uk" /><binding protocol="http" bindingInformation="140.97.30.19:80:www.ccesd.eu" /></bindings><limits connectionTimeout="00:20:00" /></site></sites></system.applicationHost><system.webServer><httpErrors lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath"><error statusCode="404" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="404.htm" /></httpErrors><httpRedirect enabled="false" /></system.webServer></configuration>
I am trying to map www.ccesd.eu to www.ccesd.ac.uk/BritSocAt such that the domain name www.ccesd.eu will always be visible. I understood that the way to do this is with a rewrite rule rather than a redirect rule; but it doesn't appear to be working.
All help gratefully received!
Ed Graham
d