I run a Sitecore multi site environment (c#/MVC). The same IIS website, same folder, same code is used for multiple websites. For example www.chalk.com and www.cheese.com, very different looking sites but both use the same IIS website (host headers), same folder, same web config, same database backend.
All is good except the error page. In the web.Config I have the usual setting:
<customErrors defaultRedirect="/error.html" mode="RemoteOnly" />
I need something like
<customErrors mode="RemoteOnly">
<error host="chalk.com" defaultRedirect="/chalkerror.html">
<error host="cheese.com" defaultRedirect="/cheeseerror.html">
</customErrors>
Is something like this possible?
In case anyone finds this question...
for me, I found the answer in Rewrite Rules.
NOTE: You need the URL Rewrite IIS Extention installed. (Download Here)
I added to the Web.Config
<system.webServer>
<rewrite>
<rules configSource="folder\filename.config" />
</rewrite>
</system.webServer>
And then a config file (filename.config)
<?xml version='1.0' encoding='utf-8'?>
<rules>
<rule name="Error-Chalk" patternSyntax="Wildcard" stopProcessing="true">
<match url="error.html" />
<action type="Rewrite" url="chalkerror.html" />
<conditions>
<add input="{HTTP_HOST}" pattern="*chalk*" />
</conditions>
</rule>
<rule name="Error-Cheese" patternSyntax="Wildcard" stopProcessing="true">
<match url="error.html" />
<action type="Rewrite" url="cheeseerror.html" />
<conditions>
<add input="{HTTP_HOST}" pattern="*cheese*" />
</conditions>
</rule>
<rules>
This line <add input="{HTTP_HOST}" pattern="*cheese*" />
makes the match on the domain name, so www.cheese.com
or image.cheese.com
will match. <match url="error.html" />
matches the page being asked for. <action type="Rewrite" url="cheeseerror.html" />
is the page IIS will serve. I can now have the different error page for the different site.