Search code examples
url-rewritingcanonical-link

Canonical Url Issue not working properly


I want to access web site without Default.aspx. I wrote the code in Application_BeginRequest in global.asax file but it is showing alway Default.aspx when access the web site.

Please provide a solution.


Solution

  • Issue can be solved by using a Rule in web.config file. It solved my Problem and is working fine in "www.tamisagency.com"

    The Rule is as follow:

    <system.webServer>
    <rewrite>
    <rules>
            <rule name="default.aspx Redirect" stopProcessing="true">
            <match url="^(.*\/)*default\.aspx$" />
            <conditions logicalGrouping="MatchAll">
              <add input="{REQUEST_METHOD}" negate="true" pattern="^POST$" />
            </conditions>
            <action type="Redirect" url="{R:1}" redirectType="Permanent"/>
          </rule>
    </rules>
    </rewrite>
    </system.webServer>