locked
URL rewriting practice on local machine RRS feed

  • Question

  • User1967010109 posted

    Hi 

    I am trying to practive URL rewrting and I came across few post that helped me out a lot but I am stuck on how to check it on machine before deploying me website to my hosting providder.

    Here is what I want to do, user will type username.mydomain.com and it should rewrite as mydomain.com/id=username 

    Saw a post on Stackoverflow and another post which is in asp.net. I modified the code as below to fit my needs

    <rewrite>
            <rules>
              <rule name="RewriteDomain" stopProcessing="true">
                <match url="*" />
                <conditions>
                  <add input="{HTTP_HOST}" pattern="^.mydomain.com" />
                </conditions>
                <action type="Rewrite" url="http://www.mydomain.com/?id={R:0}" />
              </rule>
            </rules>
    </rewrite>

    as I am running on my local machine, what will be domain, is it going to be localhost(portnumber) and I will type user,localhost(portnumber)

    Thanks for your help.

     

    Thursday, January 9, 2014 1:13 PM

Answers