标题 | WordPress去除index.php后文章页打不开的解决办法 |
内容 | 今天打开自己的博客,发现网站的内页都不能访问了,我用的是Windows主机空间,主机支持Rewrite。win主机不能像Linux主机空间那样直接在后台设置固定链接,如果你要修改的话,链接中一定要带index.php这个,否则就会提示系统找不到文件。。问了度娘和谷歌,答案是可以通过404跳转或httpd.ini达到wordpress固定链接静态化的目的,但怎么也实现不了。无奈,又问度娘和谷歌,终于找到一种方法,使用web.config设置wordpress固定链接静态化: <?xml version=”1.0″ encoding=”UTF-8″?> <configuration> <system.webServer> <httpErrors errorMode=”Detailed” /> <asp scriptErrorSentToBrowser=”true”/> <rewrite> <rules> <clear /> <rule name=”wordpress” stopProcessing=”true”> <match url=”.*” /> <conditions logicalGrouping=”MatchAll”> <add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” /> <add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” /> </conditions> <action type=”Rewrite” url=”index.php” /> </rule> <rule name=”chinese tag” stopProcessing=”true”> <match url=”/tag/(.*)” /> <conditions logicalGrouping=”MatchAll” /> <action type=”Rewrite” url=”/index.php?tag={R:1}” /> </rule> <rule name=”www” stopProcessing=”true”> <match url=”.*” /> <conditions> <add input=”{HTTP_HOST}” pattern=”^urlt$” /> </conditions> <action type=”Redirect” url=”http://www.url/{R:0}” redirectType=”Permanent” /> </rule> </rules> </rewrite> </system.webServer> </configuration> 特别说明: 1. 该段代码只有IIS 7下能生效。 |
随便看 |
|
在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。