建站知识
当前位置 :主页 > 建站知识 >

iis6上wordpress伪静态规则设置方法

来源:互联网 时间:2014-03-24
在前面数据库导入那篇文章我就说了把平板盒子搬家到了国内,国内多数主机是windows的,我那家也是,采用的是IIS6,搬家后伪静态问题困扰了我好久,今天貌似基本上搞定了。记录方法如下:

1、利用iis自带的httpd.ini文件

在网站根目录新建一个httpd.ini 内容如下:

[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32
# ISAPI_Rewrite 1.3 版本 域名的301重定向
RewriteCond Host: ^www.padhz.com$
RewriteRule (.*) http://padhz.com$1 [I,R]

# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# 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.xml.gz /sitemap.xml.gz [L]
RewriteRule /robots.txt /robots.txt [L]
RewriteRule /favicon.ico /favicon.ico [L]
#子目录,如果不添加子目录会404
RewriteRule /webimg/(.*) /webimg/$1 [L]
RewriteRule /gg/(.*) /gg/$1 [L]
# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /wp-(.*) /wp-$1 [L]
RewriteRule /wp-admin/(.*) /wp-admin/$1 [L]
# For normal wordpress content, via index.php
RewriteRule ^/$ /index.php [L]
RewriteRule /(.*) /index.php/$1 [L]