WordPress在window2003 IIS ISAPI ReWrite下的URL规则
程序员文章站
2023-11-19 14:57:22
为了便于搜索引擎抓取(换句话就是假静态),下面是url rewrite的规则,效果看我的chinadigger的链接地址。我目前的rewrite规则: ...
为了便于搜索引擎抓取(换句话就是假静态),下面是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站点目录。
复制代码 代码如下:
[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站点目录。