最新消息:本站所有跳转向bbs.ykit.cn的附件将全面停止,附件已转移到https://www.qingsj.com

IIS7.5配置web.config实现 wordpress 的伪静态

wordpress教程 有客 2337浏览

windows7已经是各位的标配了吧,那如何在windows7下实现wordpress的伪静态呢?

系统环境:windows7 + IIS7.5 + PHP + MySQL

  • IIS下的URL重写组件

  • TXT文本编辑器:自带的txt或下载一个editplus,后者比较强大实用。

     

安装URL重写组件

a. 检查URL重写组件

配置伪静态需要URL重写组件,首先确认一下IIS是否安装了URL重写组件。

在控制面板打开 Internet 信息服务(IIS)管理器,查看是否存在 “URL重写”,如下图:

b. 下载URL重写组件

无论是否安装,这里直接给一个微软官网的下载链接:

本站下载

http://download.microsoft.com/download/4/9/C/49CD28DB-4AA6-4A51-9437-AA001221F606/rewrite_x86_zh-CN.msi

重启一下IIS,运行 “net stop iis” -> “net start iis”

配置 web.config 文件

在wordpress根目录,将以下内容保存为 web.config 文件。

—————————————————————————————

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

转载请注明:有客帮 » IIS7.5配置web.config实现 wordpress 的伪静态