BB’s Blog:Talk about ChinaMobile,Mobile2.0,MovableType and Journal.
WordPress在IIS ISAPI ReWrite下的URL规则

为了便于搜索引擎抓取(换句话就是假静态),下面是URL ReWrite的规则,效果看我的chinadigger的链接地址。我目前的Rewrite规则:


[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32

# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# WordPress rewrite rules#

RewriteRule /tag/(.*)/ /index\.php\?tag=$1
RewriteRule /(about-me|about-copyright|guest-book)/ /index\.php\?pagename=$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/?$ /wp-feed\.php/\?feed=rss2
RewriteRule /comments/feed/?$ /wp-feed\.php/\?feed=comments-rss2
RewriteRule /page/(.*)/ /index\.php\?paged=$1

RewriteRule /photo/?([^/]*)?/?([^/]*)?/?([^/]*)?/?([^/]*)?/?$ /wp-content/plugins/fgallery/fim_photos\.php\?$1=$2&$3=$4 [QSA,L,I]
RewriteRule /photo/?(.*) /wp-content/plugins/fgallery/fim_photos\.php\?$1=$2&$3=$4 [QSA,L,I]

# /%year%%monthnum%%day%/%postname%/

RewriteRule /category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed\.php\?category_name=$1&feed=$2
RewriteRule /category/?(.*)/ /index\.php\?category_name=$1

RewriteRule /([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 /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /index\.php\?year=$1&monthnum=$2&day=$3&page=$4
RewriteRule /([0-9]{4})/([0-9]{1,2})/?$ /index\.php\?year=$1&monthnum=$2&page=$3

RewriteRule /([0-9]{4})([0-9]{1,2})([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /index\.php\?year=$1&monthn&day=$3&name=$4&feed=$5
RewriteRule /([0-9]{4})([0-9]{1,2})([0-9]{1,2})/([^/]+)/trackback/?$ /wp-trackback\.php\?year=$1&monthnum=$2&day=$3&name=$4&tb=1

# /post/%post_id%.html

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 /post/category/(.*)/(feed|rdf|rss|rss2|atom)/?$ /wp-feed\.php\?category_name=$1&feed=$2
RewriteRule /post/category/?(.*)/ /index\.php\?category_name=$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


使用方法(将Wordpres安装在根目录)

去discuz.net的论坛下载Rewrite的压缩包,然后按照安装方法在IIS里面配置好Rewrite,用上面的规则覆盖httpd.ini中原来的内容,再到wordpress的后台,将选项的永久链接部分,使用自定义,然后在框框里面填写上面粗体部分的内容(两种选一种,其中# /post/%post_id%.html还不太完善),即可。

本文引用bluefeel所写的规则。原文中TAG编写有问题,我已经更改完毕,大家要注意写法,否则会影响其他IIS站点目录。

本文信息

» 跟踪本文: 手机WAP
» 发表日期:2006年12月21日 8:03 PM
» 分类: 博客 Blogging
» 作者:bb
» 本文链接:http://bblog.biz/_blogging/wordpressiis_isapi_rewriteurl.htmlEDIT
» 本文引用地址:51
» 本站留言支持:html标签、coCommentgravatar
» 书签:Add to 365KeyAdd to del.icio.us百度搜藏Add to Yahoo
» 现有评论:4 条、现有引用:0 次
» 评论审核:直接点击“我要回复”评论文章,需要管理员验证后才能显示,感谢你的回复.

评论(4)

Kevin @ 2007年01月21日 8:16 PM Favicon for http://www.bluefeel.com: | 回复1楼

RewriteRule /(about-kevin|about-copyright)/ /index.php\?pagename=$1
其实对于这个,我也是没办法中的办法,因为对这个不懂,所以找不到好的办法来解决post和page的冲突,又因为page不会很多也不会经常改,所以就采用了这个好土的方法!

见笑了!

苦恼啊 @ 2007年04月19日 9:16 PM : | 回复2楼

问个很弱的问题,使用了这个规则后,唯独page页面访问不了,请问应该如何添加规则呢,好想自己写一个啊,还是没搞的太明白,因为我想要的链接是/%category%/%postname%/

bblog.biz @ 2007年04月19日 10:59 PM : | 回复3楼

>>2 To 苦恼啊 :
你问下bluefeel吧,我已经不玩WP了。

Kevin @ 2007年05月26日 1:38 AM Favicon for http://www.bluefeel.com: | 回复4楼

我也不知怎么解决tag的问题,虽然现在可以用,但是效果还是不尽人意! Embarassed

引用(0)

我要回复

昵称:   记住我的用户信息:
邮件:   Subscribe to This Entry:
主页:
Very Happy Smile Sad Surprised Shocked Confused Cool Laughing Mad Razz Embarassed Crying or Very Sad Evil or Very Mad Twisted Evil Rolling Eyes Wink
Short Cuts
Search my Blog
Subscribe This Entry
  • Enter your Email address:
Archives
Vote
评价本文:
Category Entries
Adsense
  • »