SaaS CMS has officially launched! Learn more now.

Redirect sub-domain to specific folder


I have a sub-domain pointing to another unrelated server.

I have our main www site located on Episerver dxc servers.  Once our IT department points the subdomain to the IP our www site is on, how do I go about directing that sub-domain to a specific folder?  Also the sub-domain would switch to the www domain at that point.

Any help appreciated.


Feb 08, 2017 22:24


You need to set up URL rewrite rules. The URL Rewrite Module is installed by default in Azure so just add appropriate rewrite rules in your web.config

Edited, Feb 09, 2017 0:28

Thanks for this Johan.

I just want to make sure the syntax is correct.  Does this look correct?

                <rule name="Redirect sub-domain" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="**" />
                    <action type="Redirect" url="" />

I used wildcards so it will cover http, https, the subdomain with or without anything after it.


Feb 09, 2017 18:53

You have to test this, but I'm pretty sure that match url only works on the path and query. I think you have to do something like this:

	<rule name="Redirect subdomain" stopProcessing="false">
		<match url="(.*)" />
		<conditions logicalGrouping="MatchAny">
			<add input="{HTTP_HOST}" pattern=".*" />
		<action type="Redirect" url="" redirectType="Permanent" />

Please note that you should use regex if you want to match wildcards.

Edited, Feb 10, 2017 8:56
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.