WordPress网站定制开发专家
WordPress企业主题特惠

赞一个 0

Windows主机下安装WordPress程序,默认实现不了像Linux系统环境下的完美伪静态,这也是Windows主机用户安装WordPress程序最为头疼的地方,这里WPYOU把相关方法分享给大家:

方法1:
1.1 首先,主机装Rewrite 组件,现在国内很多Windows主机默认就装这个组件了。最好做伪静态的时候先问下你的空间商。

1.2 主机启用了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]
# 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]

1.3 把httpd.ini直接上传到网站根目录即可实现。

总结:这种方式是实现Windows主机的伪静态最简单快捷的方法。

方法2:如果方法1 中代码不能实现,可以试下下面这段代码(同样是放到httpd.ini中,然后上传到网站根目录):

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# wordpress 伪静态规则
# For tag(中文标签以及标签翻页的规则)
RewriteRule /tag/(.*)/page/(\d+)$ /index\.php\?tag=$1&paged=$2
RewriteRule /tag/(.+)$ /index\.php\?tag=$1
# For category(中文分类以及分类翻页的规则)
RewriteRule /category/(.*)/page/(\d+)$ /index\.php\?category_name=$1&paged=$2
RewriteRule /category/(.*) /index\.php\?category_name=$1
# For sitemapxml
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /sitemap.html /sitemap.html [L]
RewriteRule /sitemap_baidu.xml /sitemap_baidu.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]

上一篇:

下一篇:

在线评论

在线客服
在线客服关闭
WPYOU官方微信

扫码关注官方微信