windows server 2012 iis8.5安装wordpress后设置伪静态

步骤一:首先下载 iis url-rewrite 下载地址:https://www.iis.net/downloads/microsoft/url-rewrite

安装成功后重启iis:

 

2019.5.26更新:最近安装了wordpress 5.2.1 ,用不到步骤二的伪静态代码,可以直接按照步骤三设置固定连接!(即跳过步骤二) 

 

步骤二:把以下代码编辑复制粘贴到web.config,部分截图.

 

把编辑好的web.config放到wordpress的根目录.

以下是代码:

<?xml version=”1.0″ encoding=”UTF-8″?>

<configuration>

<system.webServer>

<rewrite>

<rules>

<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>

步骤三:在后台面板的设置选项-固定链接设置规则。

我是这样设置这样文章的路径为https://www.vgo.cc/%post_id%.html这种样式,文章的地址是:https://www.vgo.cc/28.html 当然你也可以自己设置自己喜欢的链接格式.

 


评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注