Archive for the ‘部落格记事’ Category

记得早前曾经有人讨论过 WP 没有如 Bo-blog 一般支持 url 镜像。现在 WP 2.2 增加的一个功能可以变通一下支持 url 镜像咯。

最新的 WordPress 2.2 正式版里增加了一个可喜的功能,即可以通过在 wp-config.php 中通过

define('WP_HOME', ");
define('WP_SITEURL', ");

来分别指定博客首页和 WP 程序路径来代替数据库里的地址信息。那么稍微活用一下就可以使得 WP 2.2 支持 Urlmirror 镜像了。代码很短,如下:

//博客首页
$home = 'http://'.$_SERVER['HTTP_HOST'];
//WP程序的路径
$wpurl = 'http://'.$_SERVER['HTTP_HOST'].'/blog';
define('WP_HOME', $home);
define('WP_SITEURL', $wpurl);

上面的 $_SERVER[HTTP_HOST'] 就是获取当前地址的‘域名’的函数,具体效果可以分别查看我的电信主站以及网通镜像。

主域名:http://shahuhu.net
备用域名:http://sunjichao.cn

至于 Urlmirror 镜像是什么,我只能说是通过不同电信运营商的 IP 镜像服务器来访问主站以达到网际互通问题的解决(原理和代理类似,不过是可以自定义域名的代理)……具体的大家去 GG 吧。HOHO

原帖地址:http://wordpress.org.cn/forums/viewthread.php?tid=3195&fromuid=28343


中文关键字:blog cnc home urlmirror wordpress 域名 服务器 镜像 支持 2.2 http define wp 地址 server

为了这个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
13

设置ISAPI_Rewrite失败

   Posted by: 乐乐猪 Tags: , , , , , ,

不知道为什么,就是不成功,气愤。

PS:问题已解决,原因及修改方法见
WordPress permalinks(永久链接) rewrite rules for IIS


中文关键字:blog iis isapi permalinks rewrite wordpress 永久链接 永久 气愤 原因 链接 就是 成功 方法 问题
Page 5 of 5«12345