简体   繁体   English

通过使用web.config中的重写规则,无法对子页面进行规范重写

[英]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. 我们在Azure上托管了一个简单的HTML asp.net网站,当我们在浏览器中复制粘贴子页面URL(无WWW)时,我们面临重定向问题。 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) 示例:www.example.com/subpage.aspx可以正常工作,但是在复制粘贴example.com/subpage.aspx时,它会重定向到www.example.comsubpage.aspx /(坦率地说,不知道它在哪里以及如何发生)

Following code was written in the web.config file in live, (except for the exact domain name) 实时将以下代码写入web.config文件中(确切的域名除外)

<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 . 另外,将stopProccessing设置为true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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