完美的WP rewrite规则

提供可用的Rewrite下载以及规则
永久链接设置说明:/post/%post_id%.html

需要说明的是下面红色的这条规则,是对应博客导航条设置的,例如我的博客上面有“关于,留言,链接,域名出售,小工具”这几个分类,这几个分类我分别用“别名”来描述它,也分别是“about,yuming,tools,message,link ”来对应,所以就在要下面红色的规则中加进去,要不然是打不开,而是转到404页面去。

在我测试中,没有什么问题了。测试通过的有:logo显示,别名,标签,静态网页,文件夹内容显示,feed,订阅,翻页(还有没发现的)

关于“别名”,可以登陆后台–页面–编辑,选取任何一个页面进去编辑就会看到。

---------------------------------------------
httpd.ini配置如下:

[ISAPI_Rewrite]
RewriteRule /post/tag/(.*) /index\.php\?tag=$1
RewriteRule /tag/(.*) /index\.php\?tag=$1
RewriteRule /(about|yuming|tools|message|link|tags|sitemap) /index\.php\?pagename=$1
RewriteRule /post/category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed\.php\?category_name=$1&feed=$2
RewriteRule /post/category/?(.*) /index\.php\?category_name=$1
RewriteRule /author/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed\.php\?author_name=$1&feed=$2
RewriteRule /author/?(.*) /index\.php\?author_name=$1
RewriteRule /feed /index\.php/\?feed=rss2
RewriteRule /rss.xml /index\.php/\?feed=rss2
RewriteRule /comments/feed /index\.php/\?feed=comments-rss2
RewriteRule /([0-9]+)/?([0-9]+)?/?$ /index\.php\?p=$1&page=$2
RewriteRule /post/([0-9]+)/?([0-9]+)?/?$ /index\.php\?p=$1&page=$2
RewriteRule /post/([0-9]+).html /index\.php\?p=$1 [I]
RewriteRule /page/(.*)/?s=(.*) /index\.php\?s=$2&paged=$1
RewriteRule /page/(.*) /index\.php\?paged=$1
RewriteRule /post/date/([0-9]{4})([0-9]{1,2})([0-9]{1,2})/([^/]+)/?([0-9]+)?/?$ /index\.php\?year=$1&monthnum=$2&day=$3&name=$4&page=$5
RewriteRule /post/date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /index\.php\?year=$1&monthnum=$2&day=$3&page=$4
RewriteRule /post/date/([0-9]{4})/([0-9]{1,2})/?$ /index\.php\?year=$1&monthnum=$2&page=$3
RewriteRule /post/([0-9]+).html/(feed|rdf|rss|rss2|atom) /index\.php\?feed=rss2&p=$1
RewriteRule /post/([0-9]+).html/trackback /wp-trackback\.php\?p=$1
# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /wp-(.*) /wp-$1 [L]
---------------------------------------------

至于使用方法,请浏览:http://blog.ahdong.net/archives/984

点击下载该文件

6 评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注