伪静态:Typecho Rewrite for IIS(httpd.ini)

经过一个星期的测试,感觉Typecho果然很简单好用。对于我这种重度细节强迫症患者来说,网站的伪静态是必不可少的,通过搜索引擎得来的资料与自己的调试总结出了两套在Windows主机下的伪静态规则:

1.部分页面的规则(选择:WordPress风格)

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# 中文tag解决
RewriteRule /tag/(.*) /index.php?tag=$1
# sitemapxml
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
# 内容页
RewriteRule /(.*).html /index.php/$1.html [L]
# 作者
RewriteRule /author/(.*) /index.php/author/$1 [L]
# 评论
RewriteRule /(.*)/comment /index.php/$1/comment [L]
# 分类页
RewriteRule /category/(.*) /index.php/category/$1 [L]
# 分页
RewriteRule /page/(.*) /index.php/page/$1 [L]
# 搜索页
RewriteRule /search/(.*) /index.php/search/$1 [L]
# feed
RewriteRule /feed/(.*) /index.php/feed/$1 [L]
# 日期归档
RewriteRule /2(.*) /index.php/2$1 [L]
# 上传图片等
RewriteRule /action(.*) /index.php/action$1 [L]

2.三行代码搞定(选择:默认风格)

[ISAPI_Rewrite]
# 重定向后台地址
RewriteRule ^/admin(.*) /admin/$1 [L]
# 将带html htm 后缀的重写
RewriteRule ^(.*)(html|htm)$ /index.php/$1$2 [L]
# 排除带"."的 其余的全部重写
RewriteRule ^([^.]+)$ /index.php/$1 [L]

标签: none

评论已关闭