发布:2023/12/7 15:36:02作者:大数据 来源:大数据 浏览次数:902
解决地址栏中tag标签不正常
实现目的:
配置WordPress伪静态
具体操作:
一、确认IIS 7.5是否安装IIS URL Rewrite
打开:控制面板\系统和安全\管理工具\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位的程序可自行搜索
双击默认安装即可
二、添加IIS 7.5伪静态规则文件
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
<?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> <staticContent> <mimeMap fileExtension=".woff2" mimeType="application/x-font-woff" /> <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" /> </staticContent> </system.webServer> </configuration> |
2、把web.config拷贝到网站根目录:
三、设置WordPress
进入网站管理后台
设置-固定链接-自定义结构
填写:/%category%/%post_id%.html或是/%post_id%.html点击保存就可以了
这里面我们还需要一个插件的支持,那就是去除分类URL中间的category,我们只需要在后台插件→安装插件那搜索WP No Category Base,安装启用就可以了。
这样我们win系统下的wordpress程序伪静态就完成了。
© Copyright 2014 - 2025 柏港建站平台 ejk5.com. 渝ICP备16000791号-4