简体   繁体   中英

Canonical Rewrite for subpages not working by using rewrite rules in web.config

We have a simple HTML asp.net website hosted on Azure, we are facing a redirection issue when we copy paste the sub-page URL(without WWW) in the browser. Example : www.example.com/subpage.aspx works fine, but on copy pasting example.com/subpage.aspx it redirects to www.example.comsubpage.aspx/ (Frankly dunno where & how it is happening)

Following code was written in the web.config file in live, (except for the exact domain name)

<rewrite>
        <rules>
          <rule name="RedirectToWWW" stopProcessing="false">
                <match url=".*" />
               <conditions>
                    <add input="{HTTP_HOST}" pattern="^example\.com$" />
                </conditions>
                 <action type="Redirect" url="http://www.example.com/{R:0}" />
            </rule>
        </rules>
     </rewrite>

Am new to this project, so any guidance on where should I start my investigation or where should I give the fix would be very helpful.

Change to:

<action type="Redirect" url="http://www.eyeswidewhat.net/{R:1}" />

Also, set stopProccessing to true .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM