<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>睡到25点 &#187; URL Rewrite</title>
	<atom:link href="http://www.voidman.com/tag/url-rewrite/feed" rel="self" type="application/rss+xml" />
	<link>http://www.voidman.com</link>
	<description>个人博客，记录与分享，仅此而已。</description>
	<lastBuildDate>Fri, 30 Jul 2010 09:54:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WordPress 分页文章静态化的更优解决方案</title>
		<link>http://www.voidman.com/2008/11/the-better-solution-for-static-paged-post.html</link>
		<comments>http://www.voidman.com/2008/11/the-better-solution-for-static-paged-post.html#comments</comments>
		<pubDate>Wed, 12 Nov 2008 13:19:46 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Blog Related]]></category>
		<category><![CDATA[URL Rewrite]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[分页文章]]></category>
		<category><![CDATA[分页日志]]></category>
		<category><![CDATA[静态化]]></category>

		<guid isPermaLink="false">http://www.voidman.com/?p=179</guid>
		<description><![CDATA[<p class="page-links"><strong>Pages:</strong> 1 <a href="http://www.voidman.com/2008/11/the-better-solution-for-static-paged-post-2.html">2</a></p>之前用比较暴力的方式实现了分页文章的静态化，不过这样一来升级 WordPress 就不太方便了。厌烦了每次升级都要修改源文件，于是利用 WordPress 本身提供的接口实现了更好的解决方案。 以/%year%/%monthnum%/%postname%.html这样的永久链接结构为例： 1. 打开主题目录下的functions.php文件，添加以下代码： // 添加分页处理规则 function add_custom_post_rewrite_rules&#40;$rules&#41; &#123; $custom_rules = array&#40; '([0-9]{4})/([0-9]{1,2})/([^/]+)-([0-9]+)\.html$' =&#62; 'index.php?year=$matches[1]&#38;monthnum=$matches[2]&#38;name=$matches[3]&#38;page=$matches[4]', &#41;; $rules = array_merge&#40;$custom_rules, $rules&#41;; &#160; return $rules; &#125; add_filter&#40;'post_rewrite_rules', 'add_custom_post_rewrite_rules'&#41;; &#160; // 修改分页链接 function my_wp_link_pages&#40;$args = ''&#41; &#123; $args .= &#40;$args ? '&#38;' : ''&#41; . 'echo=0'; $links = wp_link_pages&#40;$args&#41;; $links = preg_replace_callback&#40;'&#124;([0-9]{4}/[0-9]{1,2}/)([^/]+)(\.html)(/)([0-9]+)&#124;', 'custom_page_link', $links&#41;; [...]]]></description>
			<content:encoded><![CDATA[<p class="page-links"><strong>Pages:</strong> 1 <a href="http://www.voidman.com/2008/11/the-better-solution-for-static-paged-post-2.html">2</a></p><p>之前用比较暴力的方式实现了<a href="http://www.voidman.com/2008/03/create-static-html-files-for-paged-post.html">分页文章的静态化</a>，不过这样一来升级 WordPress 就不太方便了。厌烦了每次升级都要修改源文件，于是利用 WordPress 本身提供的接口实现了更好的解决方案。</p>
<p>以<code>/%year%/%monthnum%/%postname%.html</code>这样的永久链接结构为例：</p>
<p>1. 打开主题目录下的<code>functions.php</code>文件，添加以下代码：</p>

<div class="wp_syntax"><pre class="php"><span style="color: #008000; font-style: italic;">// 添加分页处理规则</span>
<span style="color: blue;">function</span> add_custom_post_rewrite_rules<span style="color: #800000;">&#40;</span><span style="color: #008080;">$rules</span><span style="color: #800000;">&#41;</span> <span style="color: #800000;">&#123;</span>
  <span style="color: #008080;">$custom_rules</span> = <span style="color: blue;">array</span><span style="color: #800000;">&#40;</span>
    <span style="color: #ff00ff;">'([0-9]{4})/([0-9]{1,2})/([^/]+)-([0-9]+)<span style="">\.</span>html$'</span> =&gt; <span style="color: #ff00ff;">'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;name=$matches[3]&amp;page=$matches[4]'</span>,
  <span style="color: #800000;">&#41;</span>;
  <span style="color: #008080;">$rules</span> = <span style="color: #ff0000;">array_merge</span><span style="color: #800000;">&#40;</span><span style="color: #008080;">$custom_rules</span>, <span style="color: #008080;">$rules</span><span style="color: #800000;">&#41;</span>;
&nbsp;
  <span style="color: blue;">return</span> <span style="color: #008080;">$rules</span>;
<span style="color: #800000;">&#125;</span>
add_filter<span style="color: #800000;">&#40;</span><span style="color: #ff00ff;">'post_rewrite_rules'</span>, <span style="color: #ff00ff;">'add_custom_post_rewrite_rules'</span><span style="color: #800000;">&#41;</span>;
&nbsp;
<span style="color: #008000; font-style: italic;">// 修改分页链接</span>
<span style="color: blue;">function</span> my_wp_link_pages<span style="color: #800000;">&#40;</span><span style="color: #008080;">$args</span> = <span style="color: #ff00ff;">''</span><span style="color: #800000;">&#41;</span> <span style="color: #800000;">&#123;</span>
  <span style="color: #008080;">$args</span> .= <span style="color: #800000;">&#40;</span><span style="color: #008080;">$args</span> ? <span style="color: #ff00ff;">'&amp;'</span> : <span style="color: #ff00ff;">''</span><span style="color: #800000;">&#41;</span> . <span style="color: #ff00ff;">'echo=0'</span>;
  <span style="color: #008080;">$links</span> = wp_link_pages<span style="color: #800000;">&#40;</span><span style="color: #008080;">$args</span><span style="color: #800000;">&#41;</span>;
  <span style="color: #008080;">$links</span> = <span style="color: #ff0000;">preg_replace_callback</span><span style="color: #800000;">&#40;</span><span style="color: #ff00ff;">'|([0-9]{4}/[0-9]{1,2}/)([^/]+)(<span style="">\.</span>html)(/)([0-9]+)|'</span>, <span style="color: #ff00ff;">'custom_page_link'</span>, <span style="color: #008080;">$links</span><span style="color: #800000;">&#41;</span>;
&nbsp;
  <span style="color: blue;">echo</span> <span style="color: #008080;">$links</span>;
<span style="color: #800000;">&#125;</span>
&nbsp;
<span style="color: blue;">function</span> custom_page_link<span style="color: #800000;">&#40;</span><span style="color: #008080;">$matches</span><span style="color: #800000;">&#41;</span> <span style="color: #800000;">&#123;</span>
  <span style="color: blue;">return</span> <span style="color: #008080;">$matches</span><span style="color: #800000;">&#91;</span><span style="color: #800080;">1</span><span style="color: #800000;">&#93;</span>.<span style="color: #008080;">$matches</span><span style="color: #800000;">&#91;</span><span style="color: #800080;">2</span><span style="color: #800000;">&#93;</span>.<span style="color: #ff00ff;">'-'</span>.<span style="color: #008080;">$matches</span><span style="color: #800000;">&#91;</span><span style="color: #800080;">5</span><span style="color: #800000;">&#93;</span>.<span style="color: #008080;">$matches</span><span style="color: #800000;">&#91;</span><span style="color: #800080;">3</span><span style="color: #800000;">&#93;</span>;
<span style="color: #800000;">&#125;</span></pre></div>

<p><span id="more-179"></span><br />
2. 打开主题目录下的<code>single.php</code>文件，查找<code>wp_link_pages</code>并替换为<code>my_wp_link_pages</code>。</p>
<p>3. 后台“设置-永久链接”点击一下“保存修改”按钮，大功告成。</p>
<p>至于 life97 同学说的 <a href="http://www.voidman.com/2008/03/create-static-html-files-for-paged-post.html#comment-3781">.html/xxx 形式的链接访问失效</a>，这个可能和服务器设置有关，具体原因我也不是很清楚，不过可以通过在 .htaccess 文件中添加规则来解决此问题，如：</p>

<div class="wp_syntax"><pre class="apache">&lt;ifmodule mod_rewrite.c&gt;
<span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
<span style="color: #00007f;">RewriteBase</span> /
<span style="color: #00007f;">RewriteRule</span> ^<span style="color: #800000;">&#40;</span><span style="color: #800000;">&#91;</span><span style="color: #ff0000;">0</span><span style="color: #ff0000;">-9</span><span style="color: #800000;">&#93;</span><span style="color: #800000;">&#123;</span><span style="color: #ff0000;">4</span><span style="color: #800000;">&#125;</span><span style="color: #800000;">&#41;</span>/<span style="color: #800000;">&#40;</span><span style="color: #800000;">&#91;</span><span style="color: #ff0000;">0</span><span style="color: #ff0000;">-9</span><span style="color: #800000;">&#93;</span><span style="color: #800000;">&#123;</span><span style="color: #ff0000;">1</span>,<span style="color: #ff0000;">2</span><span style="color: #800000;">&#125;</span><span style="color: #800000;">&#41;</span>/<span style="color: #800000;">&#40;</span><span style="color: #800000;">&#91;</span>^/<span style="color: #800000;">&#93;</span>+<span style="color: #800000;">&#41;</span>\.html/trackback/?$ index.php?year=$<span style="color: #ff0000;">1</span>&amp;monthnum=$<span style="color: #ff0000;">2</span>&amp;name=$<span style="color: #ff0000;">3</span>&amp;tb=<span style="color: #ff0000;">1</span> <span style="color: #800000;">&#91;</span>L<span style="color: #800000;">&#93;</span>
<span style="color: #00007f;">RewriteRule</span> ^<span style="color: #800000;">&#40;</span><span style="color: #800000;">&#91;</span><span style="color: #ff0000;">0</span><span style="color: #ff0000;">-9</span><span style="color: #800000;">&#93;</span><span style="color: #800000;">&#123;</span><span style="color: #ff0000;">4</span><span style="color: #800000;">&#125;</span><span style="color: #800000;">&#41;</span>/<span style="color: #800000;">&#40;</span><span style="color: #800000;">&#91;</span><span style="color: #ff0000;">0</span><span style="color: #ff0000;">-9</span><span style="color: #800000;">&#93;</span><span style="color: #800000;">&#123;</span><span style="color: #ff0000;">1</span>,<span style="color: #ff0000;">2</span><span style="color: #800000;">&#125;</span><span style="color: #800000;">&#41;</span>/<span style="color: #800000;">&#40;</span><span style="color: #800000;">&#91;</span>^/<span style="color: #800000;">&#93;</span>+<span style="color: #800000;">&#41;</span>\.html/feed/<span style="color: #800000;">&#40;</span>feed|rdf|rss|rss2|atom<span style="color: #800000;">&#41;</span>/?$ index.php?year=$<span style="color: #ff0000;">1</span>&amp;monthnum=$<span style="color: #ff0000;">2</span>&amp;name=$<span style="color: #ff0000;">3</span>&amp;feed=$<span style="color: #ff0000;">4</span> <span style="color: #800000;">&#91;</span>L<span style="color: #800000;">&#93;</span>
<span style="color: #00007f;">RewriteRule</span> ^<span style="color: #800000;">&#40;</span><span style="color: #800000;">&#91;</span><span style="color: #ff0000;">0</span><span style="color: #ff0000;">-9</span><span style="color: #800000;">&#93;</span><span style="color: #800000;">&#123;</span><span style="color: #ff0000;">4</span><span style="color: #800000;">&#125;</span><span style="color: #800000;">&#41;</span>/<span style="color: #800000;">&#40;</span><span style="color: #800000;">&#91;</span><span style="color: #ff0000;">0</span><span style="color: #ff0000;">-9</span><span style="color: #800000;">&#93;</span><span style="color: #800000;">&#123;</span><span style="color: #ff0000;">1</span>,<span style="color: #ff0000;">2</span><span style="color: #800000;">&#125;</span><span style="color: #800000;">&#41;</span>/<span style="color: #800000;">&#40;</span><span style="color: #800000;">&#91;</span>^/<span style="color: #800000;">&#93;</span>+<span style="color: #800000;">&#41;</span>\.html/<span style="color: #800000;">&#40;</span>feed|rdf|rss|rss2|atom<span style="color: #800000;">&#41;</span>/?$ index.php?year=$<span style="color: #ff0000;">1</span>&amp;monthnum=$<span style="color: #ff0000;">2</span>&amp;name=$<span style="color: #ff0000;">3</span>&amp;feed=$<span style="color: #ff0000;">4</span> <span style="color: #800000;">&#91;</span>L<span style="color: #800000;">&#93;</span>
&lt;/ifmodule&gt;</pre></div>

<p>注意添加顺序，不要置于 WordPress 生成的规则之后。</p>
<p>下面是几种其它永久链接结构的具体修改代码：</p>
<ul>
<li><a href="http://img.voidman.com/wp/2008/11/year-monthnumday-postname.txt">/%year%/%monthnum%%day%/%postname%.html</a></li>
<li><a href="http://img.voidman.com/wp/2008/11/html-year-monthnum-day-postname.txt">/html/%year%/%monthnum%/%day%/%postname%.html</a></li>
<li><a href="http://img.voidman.com/wp/2008/11/category-year-monthnum-day-post_id.txt">/%category%/%year%/%monthnum%/%day%/%post_id%.html</a></li>
<li><a href="http://img.voidman.com/wp/2008/11/year-monthnumday-post_id.txt">/%year%/%monthnum%%day%/%post_id%.html</a></li>
<li><a href="http://img.voidman.com/wp/2008/11/html-post_id.txt">/html/%post_id%.html</a></li>
<li><a href="http://img.voidman.com/wp/2008/11/html-postname.txt">/html/%postname%.html</a></li>
<li><a href="http://img.voidman.com/wp/2008/11/post-postname.txt">/post/%postname%.html</a></li>
<li><a href="http://img.voidman.com/wp/2008/11/postname.txt">/%postname%.html</a></li>
<li><a href="http://img.voidman.com/wp/2008/11/category-post_id.txt">/%category%-%post_id%.html</a></li>
<li><a href="http://img.voidman.com/wp/2008/11/category-post_id2.txt">/%category%/%post_id%.html</a></li>
<li><a href="http://img.voidman.com/wp/2008/11/category-postname.txt">/%category%/%postname%.html</a></li>
</ul>
<p><strong>UPDATE at 2009-4-1</strong><br />
添加<code>/%year%/%monthnum%%day%/%post_id%.html</code>与<code>/html/%post_id%.html</code>这两种永久链接结构的修改代码</p>
<p><strong>UPDATE at 2009-4-25</strong><br />
添加<code>/%category%-%post_id%.html</code>永久链接结构的修改代码</p>
<p><strong>UPDATE at 2009-5-31</strong><br />
添加<code>/%category%/%postname%.html</code>永久链接结构的修改代码</p>
<p><strong>UPDATE at 2009-9-30</strong><br />
添加<code>/%category%/%year%/%monthnum%/%day%/%post_id%.html</code>永久链接结构的修改代码</p>
<h4>Related Posts</h4><ul class="related_post"><li><a href="http://www.voidman.com/2008/03/create-static-html-files-for-paged-post.html" title="让 Wordpress 分页文章也可以静态化">让 Wordpress 分页文章也可以静态化</a></li><li><a href="http://www.voidman.com/2008/03/trouble-with-static-wordpress.html" title="Wordpress 静态化的烦恼">Wordpress 静态化的烦恼</a></li><li><a href="http://www.voidman.com/2008/03/wordpress-can-coexist-with-gizp-and-cos-html-cache.html" title="让 GZIP 与 cos-html-cache 共存">让 GZIP 与 cos-html-cache 共存</a></li><li><a href="http://www.voidman.com/2009/05/using-wordpress-plugin-api-hack-discuz.html" title="WordPress 的 Hook 机制在 Discuz 二次开发中的应用">WordPress 的 Hook 机制在 Discuz 二次开发中的应用</a></li><li><a href="http://www.voidman.com/2009/04/at-reply-mail-notification-1-release.html" title="At Reply Mail Notification 1.0 Release">At Reply Mail Notification 1.0 Release</a></li><li><a href="http://www.voidman.com/2009/03/lbs-to-wordpress.html" title="LBS 转 WordPress 不完全记录">LBS 转 WordPress 不完全记录</a></li><li><a href="http://www.voidman.com/2009/01/wordpress-is-using-a-bad-way-to-detect-duplicate-comment.html" title="Wordpress 糟糕的重复评论检测方式">Wordpress 糟糕的重复评论检测方式</a></li><li><a href="http://www.voidman.com/2009/01/at-reply-mail-notification-test.html" title="At Reply Mail Notification 测试贴">At Reply Mail Notification 测试贴</a></li><li><a href="http://www.voidman.com/2008/11/automatically-delete-post-revisions.html" title="让 Wordpress 自动删除 Post Revisions">让 Wordpress 自动删除 Post Revisions</a></li><li><a href="http://www.voidman.com/2008/11/google-xml-sitemaps-ignore-the-specified-categories.html" title="让 Google Sitemaps Generator 可以忽略指定的日志分类">让 Google Sitemaps Generator 可以忽略指定的日志分类</a></li></ul><hr /><a href="http://www.voidman.com">Voidman.com</a> | Link: <a href="http://www.voidman.com/2008/11/the-better-solution-for-static-paged-post.html">http://www.voidman.com/2008/11/the-better-solution-for-static-paged-post.html</a><br /><img alt="linezing" width="1" height="1" src="http://img.tongji.linezing.com/288120/tongji.gif" />]]></content:encoded>
			<wfw:commentRss>http://www.voidman.com/2008/11/the-better-solution-for-static-paged-post.html/feed</wfw:commentRss>
		<slash:comments>73</slash:comments>
		</item>
		<item>
		<title>让 WordPress 分页文章也可以静态化</title>
		<link>http://www.voidman.com/2008/03/create-static-html-files-for-paged-post.html</link>
		<comments>http://www.voidman.com/2008/03/create-static-html-files-for-paged-post.html#comments</comments>
		<pubDate>Thu, 06 Mar 2008 16:53:06 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Blog Related]]></category>
		<category><![CDATA[URL Rewrite]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[静态化]]></category>

		<guid isPermaLink="false">http://www.voidman.com/2008/03/create-static-html-files-for-paged-post.html</guid>
		<description><![CDATA[WordPress 提供了多种结构标签，以便我们可以设置各种格式的永久链接结构，再配合一些静态化插件（例如 cos-html-cache），就可以使页面真正静态化。 不过 WordPress 对已分页文章的永久链接的处理方式则会给页面静态化后的访问带来问题。 例如，永久链接结构为 /%year%/%monthnum%/%postname%.html，WordPress 生成的文章相关分页链接如下所示： yourdomain.com/2008/03/postname.html yourdomain.com/2008/03/postname.html/2 yourdomain.com/2008/03/postname.html/3 可以看到 WordPress 只是简单地将页码加在了链接尾部，所以当我们静态化其中一页的内容后，我们将只能访问被静态化的那一页内容而无法访问其它分页的内容。为了可以静态化所有分页内容，需要对 WordPress 处理永久链接的方式做些小小的改动，并改变分页链接的形式： yourdomain.com/2008/03/postname.html yourdomain.com/2008/03/postname-2.html yourdomain.com/2008/03/postname-3.html 以前面提到的永久链接结构为例，作如下修改： /* 打开 wp-includes/rewrite.php 文件 找到 $rewrite = array_merge($rewrite, array($match =&#62; $query)) 在这行代码之前添加以下代码： */ if &#40;strpos&#40;$match, '.html'&#41; !== false &#38;&#38; strpos&#40;$query, '&#38;page='&#41; !== false&#41; &#123; $match = str_replace&#40;'(/[0-9]+)?/?$', '$', $match&#41;; $rewrite = array_merge&#40;$rewrite, array&#40;str_replace&#40;'([^/]+).html', '([^/]+)-([0-9]+).html', [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress 提供了多种<a href="http://codex.wordpress.org/Using_Permalinks" >结构标签</a>，以便我们可以设置各种格式的永久链接结构，再配合一些静态化插件（例如 <a href="http://www.storyday.com/html/y2008/1446_cos-html-cache-upgrade.html" >cos-html-cache</a>），就可以使页面真正静态化。</p>
<p>不过 WordPress 对<a href="http://codex.wordpress.org/Styling_Page-Links" >已分页文章</a>的永久链接的处理方式则会给页面静态化后的访问带来问题。 例如，永久链接结构为 <code>/%year%/%monthnum%/%postname%.html</code>，WordPress 生成的文章相关分页链接如下所示：</p>

<div class="wp_syntax"><pre>yourdomain.com/2008/03/postname.html 
yourdomain.com/2008/03/postname.html/2 
yourdomain.com/2008/03/postname.html/3</pre></div>

<p>可以看到 WordPress 只是简单地将页码加在了链接尾部，所以当我们静态化其中一页的内容后，我们将只能访问被静态化的那一页内容而无法访问其它分页的内容。为了可以静态化所有分页内容，需要对 WordPress 处理永久链接的方式做些小小的改动，并改变分页链接的形式：</p>

<div class="wp_syntax"><pre>yourdomain.com/2008/03/postname.html 
yourdomain.com/2008/03/postname-2.html
yourdomain.com/2008/03/postname-3.html</pre></div>

<p><span id="more-136"></span><br />
以前面提到的永久链接结构为例，作如下修改：</p>

<div class="wp_syntax"><pre class="php"><span style="color: #008000; font-style: italic;">/*
  打开 wp-includes/rewrite.php 文件
  找到 $rewrite = array_merge($rewrite, array($match =&gt; $query))
  在这行代码之前添加以下代码：
*/</span>
<span style="color: blue;">if</span> <span style="color: #800000;">&#40;</span><span style="color: #ff0000;">strpos</span><span style="color: #800000;">&#40;</span><span style="color: #008080;">$match</span>, <span style="color: #ff00ff;">'.html'</span><span style="color: #800000;">&#41;</span> !== <span style="color: blue;">false</span> &amp;&amp; <span style="color: #ff0000;">strpos</span><span style="color: #800000;">&#40;</span><span style="color: #008080;">$query</span>, <span style="color: #ff00ff;">'&amp;page='</span><span style="color: #800000;">&#41;</span> !== <span style="color: blue;">false</span><span style="color: #800000;">&#41;</span> <span style="color: #800000;">&#123;</span>
  <span style="color: #008080;">$match</span> = <span style="color: #ff0000;">str_replace</span><span style="color: #800000;">&#40;</span><span style="color: #ff00ff;">'(/[0-9]+)?/?$'</span>, <span style="color: #ff00ff;">'$'</span>, <span style="color: #008080;">$match</span><span style="color: #800000;">&#41;</span>;
  <span style="color: #008080;">$rewrite</span> = <span style="color: #ff0000;">array_merge</span><span style="color: #800000;">&#40;</span><span style="color: #008080;">$rewrite</span>, <span style="color: blue;">array</span><span style="color: #800000;">&#40;</span><span style="color: #ff0000;">str_replace</span><span style="color: #800000;">&#40;</span><span style="color: #ff00ff;">'([^/]+).html'</span>, <span style="color: #ff00ff;">'([^/]+)-([0-9]+).html'</span>, <span style="color: #008080;">$match</span><span style="color: #800000;">&#41;</span> =&gt; <span style="color: #008080;">$query</span><span style="color: #800000;">&#41;</span><span style="color: #800000;">&#41;</span>;
<span style="color: #800000;">&#125;</span></pre></div>

<p>以上代码使 WordPress 可以处理第一页后面的分页链接。其实通过修改 <code>.htaccess</code> 也可以达到同样的效果。</p>
<p>除此之外还需要修改文章分页链接生成模板。打开 <code>wp-includes/post-template.php</code> 文件，修改 <code>wp_link_pages</code> 函数（这段代码不太好贴，<a href='http://www.voidman.com/uploads/wp/2008/03/wp_link_pages.phps' title='wp_link_pages.phps'>点此查看</a>）。</p>
<p>具体效果，可以点击<a href="http://www.voidman.com/2008/01/the-journey-of-beijing.html">这里</a>还有<a href="http://www.voidman.com/2008/02/camellia-and-wintersweet.html">这里</a>查看。</p>
<p><strong>UPDATE:</strong><br />
已经有了更好的解决方案，<a href="http://www.voidman.com/2008/11/the-better-solution-for-static-paged-post.html">点此查看</a></p>
<h4>Related Posts</h4><ul class="related_post"><li><a href="http://www.voidman.com/2008/11/the-better-solution-for-static-paged-post.html" title="Wordpress 分页文章静态化的更优解决方案">Wordpress 分页文章静态化的更优解决方案</a></li><li><a href="http://www.voidman.com/2008/03/trouble-with-static-wordpress.html" title="Wordpress 静态化的烦恼">Wordpress 静态化的烦恼</a></li><li><a href="http://www.voidman.com/2008/03/wordpress-can-coexist-with-gizp-and-cos-html-cache.html" title="让 GZIP 与 cos-html-cache 共存">让 GZIP 与 cos-html-cache 共存</a></li><li><a href="http://www.voidman.com/2009/05/using-wordpress-plugin-api-hack-discuz.html" title="WordPress 的 Hook 机制在 Discuz 二次开发中的应用">WordPress 的 Hook 机制在 Discuz 二次开发中的应用</a></li><li><a href="http://www.voidman.com/2009/04/at-reply-mail-notification-1-release.html" title="At Reply Mail Notification 1.0 Release">At Reply Mail Notification 1.0 Release</a></li><li><a href="http://www.voidman.com/2009/03/lbs-to-wordpress.html" title="LBS 转 WordPress 不完全记录">LBS 转 WordPress 不完全记录</a></li><li><a href="http://www.voidman.com/2009/01/wordpress-is-using-a-bad-way-to-detect-duplicate-comment.html" title="Wordpress 糟糕的重复评论检测方式">Wordpress 糟糕的重复评论检测方式</a></li><li><a href="http://www.voidman.com/2009/01/at-reply-mail-notification-test.html" title="At Reply Mail Notification 测试贴">At Reply Mail Notification 测试贴</a></li><li><a href="http://www.voidman.com/2008/11/automatically-delete-post-revisions.html" title="让 Wordpress 自动删除 Post Revisions">让 Wordpress 自动删除 Post Revisions</a></li><li><a href="http://www.voidman.com/2008/11/google-xml-sitemaps-ignore-the-specified-categories.html" title="让 Google Sitemaps Generator 可以忽略指定的日志分类">让 Google Sitemaps Generator 可以忽略指定的日志分类</a></li></ul><hr /><a href="http://www.voidman.com">Voidman.com</a> | Link: <a href="http://www.voidman.com/2008/03/create-static-html-files-for-paged-post.html">http://www.voidman.com/2008/03/create-static-html-files-for-paged-post.html</a><br /><img alt="linezing" width="1" height="1" src="http://img.tongji.linezing.com/288120/tongji.gif" />]]></content:encoded>
			<wfw:commentRss>http://www.voidman.com/2008/03/create-static-html-files-for-paged-post.html/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>
