wordpress固定链接设置在新建网站的时候特别重要,因为它对SEO起到很好的作用。但是WordPress在IIS主机设置固定链接时,老会提示404错误。
需要:
第一步:服务器上已经安装好了Helicon ISAPI_Rewrite3
第二步:在IIS网站上安装ISAPI筛选器,配置:
第三步:把以下代码保存为httpd.ini,传到web根目录
[ISAPI_Rewrite]
# Defend your computer from some worm attacks
#RewriteRule .*(?:global.asa|default.ida|root.exe|..).* . [F,I,O]
# 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 /software-files/(.*) /software-files/$1 [L]
RewriteRule /images/(.*) /images/$1 [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]
第四步:配置Wordpress的固定链接
一般企业或资讯类的站建议这样:/%cagtegory%/%postname%.html
以上配置亲测可用!但不支持中文Url。
我个人也不喜欢中文Url,就这样吧:)