urliis-7url-rewritingiis-manager

IIS manager rewrite all URLS after mysite.com/


I'm trying to rewrite all the urls for my website. For example, if the user types in mysite.com/index.aspx it'll change the url in the top to www.mysite.com/index.aspx

Any suggestions?


Solution

  • Try this one

    <rewrite>
        <rules>
            <rule name="Enforce canonical hostname" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTP_HOST}" negate="true" pattern="^www\.mysite\.com$" />
                </conditions>
                <action type="Redirect" url="http://www.mysite.com/{R:1}" redirectType="Permanent" />
            </rule>
        </rules>
    </rewrite>