15

WordPress permalinks(永久链接) rewrite rules for IIS

   Posted by: 乐乐猪   in WordPress

为了这个permalinks(永久链接) 真是花费我好多的时间,从星玄宇那里知道蓝风的httpd.ini规则文件设置,但用到我WordPress上就一直没有效果,于是一直在找原因,期间让服务器的管理员帮忙覆盖文件N次,这里感激一下速度吧的技术管理员,耐心真的很好,后来我在自己机器上架了一个WordPress的运行环境,才找到了失败的原因,缺少对 UriMatchPrefix 和 UriFormatPrefix 的设置。因为我的WordPress有一层目录,所以直接把蓝风的httpd.ini文件拿过来不能直接使用。

蓝风原文 WordPress permalinks(永久链接) rewrite rules for IIS

贴一下我的 httpd.ini文件,希望对后来者有所帮助

[ISAPI_Rewrite]
 
# WordPress rewrite rules
# Design by Kevin http://www.bluefeel.com
# /%year%%monthnum%%day%/%postname%/
 
# UriMatchPrefix \/weblog
# UriFormatPrefix \/weblog
 
RewriteRule /php /phpinfo
RewriteRule /tag/(.*) /index\.php\?tag=$1
RewriteRule /(aboutme|works|resources|guestbook|archives|sitemap|links|works|pluginsused)/ /index.php\?pagename=$1
RewriteRule /category/(.*)/(feed|rdf|rss|rss2|atom)/?$ \/weblog\/wp-feed.php\?category_name=$1&feed=$2
RewriteRule /category/?(.*)/ /index.php\?category_name=$1
 
RewriteRule /author/(.*)/(feed|rdf|rss|rss2|atom)/?$ \/weblog\/wp-feed.php\?author_name=$1&feed=$2
RewriteRule /author/?(.*) /index.php\?author_name=$1
 
RewriteRule /feed/?$ \/weblog\/\?feed=rss2
RewriteRule /comments/feed/?$ \/weblog\/\?feed=comments-rss2
 
RewriteRule /page/(.*)/ /index.php\?paged=$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&monthnum=$2&day=$3&name=$4&feed=$5
RewriteRule /([0-9]{4})([0-9]{1,2})([0-9]{1,2})/([^/]+)/trackback/?$ \/weblog\/wp-trackback.php\?year=$1&monthnum=$2&day=$3&name=$4&tb=1
 
RewriteRule /sitemap/(.*)/ /index.php\?page_id=3&pg=$1

因为我有层目录,所以要加UriMatchPrefix 和 UriFormatPrefix 的设置
其中(aboutme|works|resources|guestbook|archives|sitemap|links)部分是对单独页面的解析,“|”分隔页面。


中文关键字:blog iis isapi permalinks plugins rewrite wordpress 服务器 永久链接 永久 链接 rules for rewriterule feed

相关日志 :

Tags: , , , , , , , ,

This entry was posted on 星期五, 六月 15th, 2007 at 4:33 下午 and is filed under WordPress. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

4 comments so far

 1 

http://www.pigegg.com/blog/index.php/2007/07/12/wordpress-permalinks-chinese-title-support-problem/

能不能帮忙看一下 永久链接有问题

[回复]

七月 12th, 2007 at 10:35 下午
 2 

建议给每篇文章加英文缩略名,有缩略名的文章,在使用 sample-post的时候,显示的就是你起的缩略名,而不是原来的中文标题。像你现在《我想吃肉》这篇一样,文章名《我想吃肉》缩略名i-want-meat,显示的就没有问题。

[回复]

七月 13th, 2007 at 7:30 上午
 3 

我的是放在一个weblog子目录下,跟目录是一个discuz论坛,应该跟你的情况差不多,不知道应该弄,能不能帮下忙

[回复]

十二月 14th, 2007 at 6:26 下午
 4 

我被永久链接把头搞爆炸了。我是自己的服务器,apache已经支持rewrite了,但是改成任何格式的永久练级都会找不到url,
你这个http.ini是什么文件?apache的设置文件不是http.conf吗,怎么http.ini是放在哪的?

[回复]

十一月 21st, 2008 at 10:01 上午

One Trackback/Ping

  1. 终于搞定Wordpress 2.5 permalinks rewrite rules for IIS | Jackly's blog    四 01 2008 / 1下午:

    [...] 为了完美的实现伪静态,快被permalinks的404错误整死了。 经过N多资料的收集,让空间商的客服和我一起忙了半天,终于在傻瓜不傻的博客上找到了一个很好了httpd.ini的解决方案。当然最早写这个httpd.ini是蓝风。 (本来用甜蚂蚁(转)的解决方案可以实现postname%.html的,可是由于没有完全看懂代码,最后被替换掉了。也不想再麻烦空间商了。) [...]

Leave a reply

Name (*)
Mail (will not be published) (*)
URI
Comment