Loading
0

httpd.ini伪静态规则转换为ii7规则后无法使用解决方法
被墙跳转TG:@qianhenetwork QQ 851617266

301免备案跳转微信公众号
腾讯云服务器大促销。
华为服务器
在处理问题过程中,经常会遇到将http.ini规则转换为iis7规则,iis中导入规则后能正常转换为iis7规则,但实际上规则是有误的,无法正常使用,需参考如下方法修改后方可使用
url="/ 替换为  url="
\.     替换为  . 
\?     替换为  ?
\_     替换为  _
//将http.ini规则直接在iis7下转换后的格式如下
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Òѵ¼ÈëµÄ¹æÔò 1" stopProcessing="true">
                    <match url="^(.*)/article-([0-9]+).html$" />
                    <action type="Rewrite" url="{R:1}/article\.asp\?id={R:2}" appendQueryString="false" />
                </rule>
                <rule name="Òѵ¼ÈëµÄ¹æÔò 2" stopProcessing="true">
                    <match url="^(.*)/show-([0-9]+).html$" />
                    <action type="Rewrite" url="{R:1}/show\.asp\?id={R:2}" appendQueryString="false" />
                </rule>
                <rule name="Òѵ¼ÈëµÄ¹æÔò 3" stopProcessing="true">
                    <match url="^(.*)/guestbook.html$" />
                    <action type="Rewrite" url="{R:1}/guestbook\.asp" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

//重新调整后正确可用的规则如下 //去掉了“(.*)”、去掉了“{R:1}”、将{R:2}改成{R:1}、将多余的斜杠去掉了

<rule name="Òѵ¼ÈëµÄ¹æÔò 1" stopProcessing="true">
    <match url="^article-([0-9]+).html$" />
    <action type="Rewrite" url="article.asp?id={R:1}" appendQueryString="false" />
</rule>
<rule name="Òѵ¼ÈëµÄ¹æÔò 2" stopProcessing="true">
    <match url="^show-([0-9]+).html$" />
    <action type="Rewrite" url="show.asp?id={R:1}" appendQueryString="false" />
</rule>
<rule name="Òѵ¼ÈëµÄ¹æÔò 3" stopProcessing="true">
    <match url="^guestbook.html$" />
    <action type="Rewrite" url="guestbook.asp" />
</rule>
301免备案跳转微信公众号
华为服务器
腾讯云服务器大促销。

声明:站长码字很辛苦啊,转载时请保留本声明及附带文章链接:https://www.zfcdn.xyz/showinfo-8-247-0.html
亲爱的:被墙域名跳转TG:@qianhenetwork QQ:851617266,可否收藏+评论+分享呢?
上一篇:web.config规则中过滤某个文件不受规则影响方法
下一篇:web.config各种跳转规则大全-持续更新