sdcms网站优化如何利用web.config实现虚拟主机单页面html页面301重定向的方法给大家讲一下,希望对大家做网站优化有帮助。当然,有一些只是需要单页面进行301定向,比如某个信息:
那以下就先给大家写一个演示代码实现虚拟机的web.config301到指定页面的。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect(命名)" stopProcessing="true">
<match url="^(要重定向的页面)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="(重定向到的页面)" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
需要多个html页面跳转代码如下,以此类推
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect" stopProcessing="true">
<match url="^abc/001.html" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://" />
<rule name="Redirect2" stopProcessing="true">
<match url="^abc/002.html" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
温馨提示:多个页面跳转时,rule name 不能相同,否则会错误。
备注:部分网站模板整理自网络,如有侵权,请及时与我们沟通处理。
如若看不到文章内容及下载地址,注册免费会员既可。
更多好看的企业SDCMS模板可加QQ群:
