locked
Problems doing a URL rewrite RRS feed

  • Question

  • User-1204637165 posted

    There all I have a app that I currently have several merchants on. I give each merchant links to my app which a customer can use to address their services.

    My app as several software modules for merchants so as a customer to you access their software packages via  their url tied to their username. Right now becos I want to tie this url to a their main domain. I have to follow the subdomain format. 

    My current format is mydomain.com/username

    New format is username.mydomain.com

    So I have this URL rewrite module that I found online

    	<rewrite>
                <rules>
                  <rule name="sub domain map" patternSyntax="ECMAScript" stopProcessing="false">
                    <match url="(.*)" />
    
                    <action type="Rewrite" url="^(?!www\.)(\w+)\.\w+\.\w+$"   appendQueryString="true" />
                    <conditions trackAllCaptures="true">
                      <add input="{HTTP_HOST}" pattern="{C:1}/{R:1}" />
                    </conditions>
    			  
                  </rule>
                </rules>

    I want that url rewrite above to change a current format

    mydomain.com/username    to username.mydomain.com

    So for the other software packages I give them like

    mydomain.com/shop/username   to username.mydomain.com/shop

    mydomain.com/feedback/username to username.mydomain.com/feedback.

    Please if anyone knows how to do this kindly let me know.  I woud be very grateful for your support.

    Saturday, November 10, 2018 6:01 AM

Answers

  • User475983607 posted

    I would simply configure IIS to bind the sub domains to the main application and just let the main app continue to function as is.  Then just write a bit of code that validates the sub domain matches the username.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 10, 2018 3:00 PM

All replies

  • User475983607 posted

    I would simply configure IIS to bind the sub domains to the main application and just let the main app continue to function as is.  Then just write a bit of code that validates the sub domain matches the username.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 10, 2018 3:00 PM
  • User-1204637165 posted

    Thanks alot your suggestion seems to be very great.

    My app runs on azure. How do I fix that. Please can you give a sample of how I can do that binding. I would love to follow thru thanks alot.

    Thursday, November 15, 2018 12:38 AM