2019年11月14日 星期四
主页 / 工作日志 / Redirect non-www to www

Redirect non-www to www

To redirect requests without the www to www on sites on IIS7, adding the following rules to your web.config.
Make sure lirongyao.com below is changed to www.lirongyao.com.
NOTE: If you already have a web.config with rules configured, add the rule below, otherwise a full web.config example is below it.

Rule
=========================================================================

        <rule name=”Redirect to WWW” stopProcessing=”true”>
          <match url=”.*” />
<
conditions>
            <add input=”{HTTP_HOST}” pattern=”^lirongyao.com$” />
</
conditions>
          <action type=”Redirect” url=”http://www.lirongyao.com/{R:0}” redirectType=”Permanent” />
</
rule>

Full Web.Config with Rule
==========================================================================

<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name=”Redirect to WWW” stopProcessing=”true”>
          <match url=”.*” />
<
conditions>
            <add input=”{HTTP_HOST}” pattern=”^lirongyao.com$” />
</
conditions>
          <action type=”Redirect” url=”http://www.lirongyao.com/{R:0}” redirectType=”Permanent” />
</
rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

原创文章,转载请注明: 转载自荣耀博客
本文链接地址: Redirect non-www to www

关于 荣耀博客

好记性,不如烂笔头。

随机推荐

税控发票开票软件(金税盘版)循环更新登录解决方法插图

税控发票开票软件(金税盘版)循环更新登录解决方法

税控发票开票软件(金税盘版)v …

发表评论

'); })();