[v_notice]说明:
操作系统:Windows Server 2008
Web服务器:IIS 7.5
网站程序:WordPress 4.1
网站根目录:-D:/china-so/
网站域名:www.china-so.net
实现目的:
配置WordPress伪静态[/v_notice]
具体操作:
[v_act]一、确认IIS 7.5是否安装IIS URL Rewrite[/v_act]
打开:控制面板\系统和安全\管理工具\Internet Information Services (IIS)管理器
看到URL重写,说明已经安装了IS URL Rewrite,否则要先安装此插件。
IIS URL Rewrite下载:http://download.microsoft.com/download/4/E/7/4E7ECE9A-DF55-4F90-A354-B497072BDE0A/rewrite_x64_zh-CN.msi
32位的程序可自行搜索
双击默认安装即可
[v_act]二、添加IIS 7.5伪静态规则文件[/v_act]
1、新建web.config文件,添加以下代码,保存
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
<?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> |
2、把web.config拷贝到网站根目录:
[v_act]三、设置WordPress[/v_act]
进入网站管理后台
设置-固定链接-自定义结构
填写:/%post_id%.html
保存