Web.config to Redirect Subdomain to Folder RRS feed

  • Question

  • I'm using Azure websites. I have mydomain.azurewebsites.net.  I haven't done a Web.config before.  I already setup the following subdomains and have SSL:


    I want them redirected as follows:

    https://m.mydomain.com --> mydomain.com/m
    https://www.m.mydomain.com --> mydomain.com/m
    https://m2.mydomain --> mydomain.com/m2

    As I understand it I can do this with a web.config rule.  After looking around I came up with these rules.  Will these work? If not, can you make suggestions on how to fix. 

    	 <rule name="Redirect subdomain m" enabled="true">
            <match url="^(.*)$" />  
    		  <add input="{HTTP_HOST}" pattern="^(www\.)m\.mydomain\.azurewebsites\.net$" />
    		<action type="Redirect" url="https://mydomain.com/m" />  
    	 <rule name="Redirect subdomain m2" enabled="true">
            <match url="^(.*)$" />  
    		  <add input="{HTTP_HOST}" pattern="^m2\.mydomain\.azurewebsites\.net$" />
    		<action type="Redirect" url="https://mydomain.com/m2" />  

    Friday, July 26, 2019 8:53 PM

All replies