windows2008 iis7.5 WordPress静态规则301教程方法,有不少WordPress爱好者在更换系统或者使用windows2008 iis7.5的时候会遇到静态规则不会处理。
现由源码专家技术钟振森为写一个规则分享给大家:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="301Redirect" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^xuguoxiang.com$" />
</conditions>
<action type="Redirect" url="http://www.xuguoxiang.com/{R:0}" redirectType="Permanent" />
</rule>
<rule name="category">
<match url="category/?(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="/index.php?category_name={R:1}" appendQueryString="false" logRewrittenUrl="false" />
</rule>
<rule name="tags">
<match url="tag/?(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="index.php?tag={R:1}" />
</rule>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" />
</rule>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule></rules>
</rewrite>
</system.webServer>
</configuration>
把以上代码复制到txt里面然后把txt改为web.config上传到网站根目录即可。
如你服务器还没有安装url这个插件的需要去下载一下安装一下。
原文链接:https://www.qiquanji.com/post/8221.html
本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。
微信扫码关注
更新实时通知