WP伪静态对于Linux主机是十分容易的事情,但在Windows主机IIS环境下就比较棘手了,你是否遇到了一样的问题呢?今天就来教你如何在Win主机IIS环境下进行WP伪静态配置。
Windows主机IIS环境下伪静态需要主机启用了Rewrite模块,不然是不会起作用的。主机启用了Rewrite模块,剩下的只需要一个Httpd.ini就能解决问题了。
httpd.ini是指wordpress程序在windows虚拟主机上的伪静态设置。下面就贴出WP伪静态的Httpd.ini代码:
ISAPI_Rewrite
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# Rules to ensure that normal content gets through
RewriteRule /sitemap.xml /sitemap.xml L
RewriteRule /favicon.ico /favicon.ico L
RewriteRule /sitemap_baidu.xml /sitemap_baidu.xml L
RewriteRule /sitemap.html /sitemap.html L
RewriteRule /archivers/(.*) /archivers/$1 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
把上面的代码复制保存为httpd.ini文件,上传至网站根目录即可。