Windows主机服务器空间IIS下WordPress伪静态httpd.ini规则与tag伪静态出现404解决方法

首先直接新建1个txt文档,再复制虚横线之下的代码内容,粘贴到txt文档里面保存后,再修改文档文件名为httpd.ini就可以了。
  将httpd.ini文件直接上传到菜菜互联FTP空间的WEB文件夹根目录下,最后在固定链接中设置为自己想要的即可使用。

注意:这个伪静态规则文件仅适合WordPress博客使用,对版本没要求!

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

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# 中文tag解决
RewriteRule /tag/(.*) /index.php?tag=$1
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rules to ensure that normal content gets through
RewriteRule /robots.txt  /robots.txt [L]
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /wp-(.*) /wp-$1 [L]
# For normal wordpress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php/$1 [L]

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

PS:

如果 自己上传或者程序原有的html文件、图片,在应用后出现404错误,可以在httpd.ini文件里找到# Rules to ensure that normal content gets through,在底下加上这样规则(下面的xxx需要根据自己实际上传的图片或者html文件名而修改):
RewriteRule /xxx.html /xxx.html [L]
RewriteRule /xxx.jpg /xxx.jpg [L]

举例:如果在web文件夹根目录下,有1个read.html和logo.jpg文件需要正常显示,则需要加入这样的规则代码:
RewriteRule /readme.html /readme.html [L]
RewriteRule /logo.jpg /logo.jpg [L]

完整的伪静态规则代码则要改成:

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

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# 中文tag解决
RewriteRule /tag/(.*) /index.php?tag=$1
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rules to ensure that normal content gets through
RewriteRule /robots.txt  /robots.txt [L]
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
RewriteRule /readme.html /readme.html [L]
RewriteRule /logo.jpg /logo.jpg [L]
# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /wp-(.*) /wp-$1 [L]
# For normal wordpress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php/$1 [L]

本文摘自网络,由Java地带收集整理,转载请保留原文链接《Windows主机服务器空间IIS下WordPress伪静态httpd.ini规则与tag伪静态出现404解决方法》,谢谢!


» 本文链接:https://blog.apires.cn/archives/980.html
» 转载请注明来源:Java地带  » 《Windows主机服务器空间IIS下WordPress伪静态httpd.ini规则与tag伪静态出现404解决方法》

» 本文章为Java地带整理创作,欢迎转载!转载请注明本文地址,谢谢!
» 部分内容收集整理自网络,如有侵权请联系我删除!

» 订阅本站:https://blog.apires.cn/feed/

标签: IIS, Windows服务器, WordPress伪静态

添加新评论