AI OnAI Off
Hi,
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 https://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module.
Thanks for this Johan.
I just want to make sure the syntax is correct. Does this look correct?
<rewrite> <rules> <rule name="Redirect sub-domain" patternSyntax="Wildcard" stopProcessing="true"> <match url="*sub.domain.com*" /> <action type="Redirect" url="www.domain.com/newpage/" /> </rule> </rules> </rewrite>
I used wildcards so it will cover http, https, the subdomain with or without anything after it.
Thanks
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=".*sub.domain.com" /> </conditions> <action type="Redirect" url="http://www.domain.com/folder/" redirectType="Permanent" /> </rule>
Please note that you should use regex if you want to match wildcards.
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.
Thanks