<?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>站趣-分享建站的乐趣Showfom</title>
	<atom:link href="http://eachsite.org/author/showfom/feed/" rel="self" type="application/rss+xml" />
	<link>http://eachsite.org</link>
	<description>站趣致力于一起分享建站的乐趣，并制作各种 WordPress 使用教程、主题以及插件，并关注各种互联网新鲜应用，使国人轻松建站、快乐建站。</description>
	<lastBuildDate>Thu, 29 Mar 2012 08:55:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>打造 WordPress 的简易短网址</title>
		<link>http://eachsite.org/shortened-url-of-current-page-to-twitter/</link>
		<comments>http://eachsite.org/shortened-url-of-current-page-to-twitter/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 11:06:10 +0000</pubDate>
		<dc:creator>Showfom</dc:creator>
				<category><![CDATA[WordPress 教程]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://eachsite.org/?p=842</guid>
		<description><![CDATA[WordPress 2.8 以后，Permalink 系统已经很完美了，系统能自己判断错误的地址并且指向一个可能存在的地址，举个例子：
比如，这个文章地址并不存在：http://showfom.com/wo/ 但是 访问以后，WordPress 会判断最接近的地址，所以，就跳转到了 http://showfom.com/wordpress-28-released/ ，嗯，很智能吧？这样能有效防止损失的流量。

同样，以前我推荐过 Permalink Redirect 插件，目的是为了防止访问类似 http://showfom.com/?p=1 这样的地址时能自动跳转到自定义的 Permalink，而 WordPress 2.8 以后，根本用不着 Permalink Redirect 插件 ，因为内置的 Rewrite系统 已经能自动301跳转，根本用不着插件的支持，所以，就衍生了这篇文章。
我重点要讲的是如何利用 WordPress 打造一个简易的短网址，为每篇文章都建立一个短网址，而且增加一个 Retweet 链接，下面，就听 Showfom 小帅锅一一道来：
我们知道，默认没有自定义永久链接的时候，WordPress 每个文章的访问地址是类似于 http://showfom.com/?p=81 这样的，而 WordPress 2.8+ 的 Rewrite 机制完美地解决了301跳转问题，所以，利用这一点，我们可以为每个文章都弄一个类似 http://showfom.com/go/81 这样的短网址.
方法如下，Apache 主机的，打开根目录的 .htaccess 文件，输入这两行：
# Redirect posts based on post-id
RewriteEngine On
RewriteRule ^go/([0-9]+)$ ?p=$1 [R=301,L]
通常因为开启了永久链接，所以 RewriteEngine On 本身存在，那么只要把 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>WordPress 2.8</strong> 以后，<strong>Permalink 系统</strong>已经很完美了，系统能自己判断错误的地址并且指向一个可能存在的地址，举个例子：</p>
<p>比如，这个文章地址并不存在：<a title="一个不存在的地址" rel="nofollow" href="http://showfom.com/wo/">http://showfom.com/wo/</a> 但是 访问以后，WordPress 会判断最接近的地址，所以，就跳转到了 <a title="一个存在的实际地址" href="http://showfom.com/wordpress-28-released/">http://showfom.com/wordpress-28-released/</a> ，嗯，很智能吧？这样能有效防止损失的流量。<br />
<span id="more-842"></span></p>
<p>同样，以前我推荐过 <a title="Permalink Redirect" href="http://wordpress.org/extend/plugins/permalink-redirect/" target="_blank">Permalink Redirect</a> 插件，目的是为了防止访问类似 <a href="http://showfom.com/?p=1">http://showfom.com/?p=1</a> 这样的地址时能自动跳转到<strong>自定义的 Permalink</strong>，而 <strong>WordPress 2.8</strong> 以后，根本用不着<strong> Permalink Redirect 插件</strong> ，因为内置的 <strong>Rewrite系统</strong> 已经能<strong>自动301跳转</strong>，根本用不着插件的支持，所以，就衍生了这篇文章。</p>
<p>我重点要讲的是如何利用 <strong>WordPress </strong>打造一个简易的短网址，为每篇文章都建立一个短网址，而且增加一个 Retweet 链接，下面，就听 <strong>Showfom 小帅锅</strong>一一道来：</p>
<p>我们知道，默认没有自定义永久链接的时候，<strong>WordPress</strong> 每个文章的访问地址是类似于 <a title="本页原始地址" rel="nofollow" href="http://showfom.com/?p=81">http://showfom.com/?p=81</a> 这样的，而 <strong>WordPress 2.8+</strong> 的<strong> Rewrite</strong> 机制完美地解决了<strong>301跳转</strong>问题，所以，利用这一点，我们可以为每个文章都弄一个类似 <a title="本页短网址" rel="nofollow" href="http://showfom.com/go/81">http://showfom.com/go/81</a> 这样的短网址.</p>
<p>方法如下，<strong>Apache </strong>主机的，打开根目录的<strong> .htaccess</strong> 文件，输入这两行：</p>
<pre># Redirect posts based on post-id
RewriteEngine On
RewriteRule ^go/([0-9]+)$ ?p=$1 [R=301,L]</pre>
<p>通常因为开启了永久链接，所以 <strong>RewriteEngine On</strong> 本身存在，那么只要把 <strong>RewriteRule ^go/([0-9]+)$ ?p=$1 [R=301,L]</strong> 加入到 <strong>RewriteEngine On</strong> 这样下面即可。</p>
<p>这时候，测试一下，是否可以用 <a title="本页短网址" rel="nofollow" href="http://showfom.com/go/81">http://showfom.com/go/81</a> 这样的网址来访问，测试结果很让人满意。</p>
<p>我们知道，这个81是个<strong>postid</strong>，那么，如何让他自动在模板中显示呢？用到一个函数即可：</p>
<pre>&lt;?php the_ID(); ?&gt;</pre>
<p>很神奇吧？</p>
<p>这样，我们在模板的 <strong>single.php</strong> 里适当位置（一般是&lt;?php the_content(&#8221; &#8220;); ?&gt;这个函数下方合适）增加一行代码：</p>
<blockquote><p>&lt;br /&gt;</p>
<p>本文短网址：&lt;a href=&#8221;&lt;?php echo get_option(&#8216;home&#8217;); ?&gt;/go/&lt;?php the_ID(); ?&gt;&#8221; title=&#8221;&lt;?php the_title(); ?&gt;&#8221; rel=&#8221;external nofollow&#8221; &gt;&lt;?php echo get_option(&#8216;home&#8217;); ?&gt;/go/&lt;?php the_ID(); ?&gt;&lt;/a&gt;</p></blockquote>
<p>(注意标点，要用英文输入法状态下的引号)</p>
<p>当然，有了这个简易的短网址，我们用来干什么呢？废话，当然是发布在Twitter等微博上了，然后，我们就加一条Retweet的链接：</p>
<blockquote><p>如果你觉得本文很可爱，请使用 Twitter 来 RT 本文：&lt;a  href=&#8221;<a href="https://twitter.com/home?status=RT">https://twitter.com/home?status=RT</a> @Showfom : &lt;?php the_title(); ?&gt; &lt;?php echo get_option(&#8216;home&#8217;); ?&gt;/go/&lt;?php the_ID(); ?&gt;&#8221; title=&#8221;Tweet this post&#8221;&gt;ReTweet This&lt;/a&gt;</p></blockquote>
<p>自行修改 <strong>@Showfom</strong> 为自己的 <strong>Twitter</strong> 账户名，样式可以自己写一个，为了简洁我就不写了，效果参考本文下方的<strong> ReTweet This</strong> 字样即可。</p>
<p>===</p>
<p><strong>PS：</strong>我知道很多人有洁癖，非得用个.html结尾，那么.htaccess规则就是</p>
<blockquote><p>RewriteRule ^go/([0-9]+)\.html$ ?p=$1 [R=301,L]</p></blockquote>
<p>这样就可以通过 <a title="本页短网址" rel="nofollow" href="http://showfom.com/go/81.html">http://showfom.com/go/81.html</a> 来访问本站</p>
<p>还有人和我一样有洁癖，非得在链接最后加个斜杠，那么.htaccess规则就是</p>
<blockquote><p>RewriteRule ^go/([0-9]+)\$ ?p=$1 [R=301,L]</p></blockquote>
<p>这样就可以通过 <a title="本页短网址" rel="nofollow" href="http://showfom.com/go/81/">http://showfom.com/go/81/</a> 来访问本页</p>
<p>===</p>
<p><strong>再次PS：Nginx </strong>下的规则分别是：</p>
<blockquote><p>rewrite ^/go/([0-9]+)$ /?p=$1 permanent;</p>
<p>break;</p></blockquote>
<blockquote><p>rewrite ^/go/([0-9]+)\$ /?p=$1 permanent;</p>
<p>break;</p></blockquote>
<blockquote><p>rewrite ^/go/([0-9]+)\.html$ /?p=$1 permanent;</p>
<p>break;</p></blockquote>
<p>再推荐一个在线转换 <strong>Apache </strong>的<strong> .htaccess</strong> 和<strong> Nginx</strong> 伪静态规则的网站：<a title="Convert Apache Htaccess To Nginx" href="http://www.anilcetin.com/convert-apache-htaccess-to-nginx/" target="_blank">http://www.anilcetin.com/convert-apache-htaccess-to-nginx/</a></p>
<p>===</p>
<p><strong>再再次PS：</strong>因为短网址的原理是301转向，所以害怕搜索引擎的童鞋就别冒险了哈哈。<br />
(<a href="http://showfom.com/shortened-url-of-current-page-to-twitter/">Via</a>)</p>
<ul class="related_post"><li><a href="http://eachsite.org/wordpress-theme-ari/" title="WordPress 主题 Ari">WordPress 主题 Ari</a> (10)</li><li><a href="http://eachsite.org/wordpress-theme-high-art/" title="WordPress 主题 High Art Blog">WordPress 主题 High Art Blog</a> (3)</li><li><a href="http://eachsite.org/google-1-button-for-wordpress-plugin/" title="Google +1 按钮 WordPress 插件">Google +1 按钮 WordPress 插件</a> (7)</li><li><a href="http://eachsite.org/wpus-online-today/" title="WordPress主题巴士今日上线">WordPress主题巴士今日上线</a> (5)</li><li><a href="http://eachsite.org/wordpress-theme-imbalance/" title="WordPress 主题 Imbalance">WordPress 主题 Imbalance</a> (5)</li><li><a href="http://eachsite.org/eachsite-new-wp-cms-theme-online/" title="站趣新版上线">站趣新版上线</a> (16)</li><li><a href="http://eachsite.org/wordpress-them-tanzaku/" title="WordPress 主题 tanzaku">WordPress 主题 tanzaku</a> (10)</li><li><a href="http://eachsite.org/transfer-wordpress-via-ssh/" title="通过SSH迁移WordPress博客">通过SSH迁移WordPress博客</a> (13)</li><li><a href="http://eachsite.org/wordpress-theme-wp-remix/" title="Wordpress 主题 WP Remix">Wordpress 主题 WP Remix</a> (2)</li><li><a href="http://eachsite.org/wordpress-theme-js-o4w/" title="Wordpress 主题 Js O4w">Wordpress 主题 Js O4w</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://eachsite.org/shortened-url-of-current-page-to-twitter/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>四种去除 WordPress 永久链接中讨厌的 category 方法</title>
		<link>http://eachsite.org/4-ways-to-remove-category-from-your-wordpress-url/</link>
		<comments>http://eachsite.org/4-ways-to-remove-category-from-your-wordpress-url/#comments</comments>
		<pubDate>Wed, 13 May 2009 13:10:21 +0000</pubDate>
		<dc:creator>Showfom</dc:creator>
				<category><![CDATA[WordPress 教程]]></category>
		<category><![CDATA[进阶使用]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[永久链接]]></category>

		<guid isPermaLink="false">http://eachsite.org/?p=660</guid>
		<description><![CDATA[默认的 WordPress 地址中，分类地址总有一个 category ，看着就比较讨厌，比如 站趣 的 WordPress 教程 分类地址就是 http://eachsite.org/category/wordpress-course/
由于我对永久链接（Permalink）比较过敏，别笑，在座的各位肯定有比我更加过敏的，所以我单篇日志的永久链接设置成/%postname%/，然后分类，总是有一个讨厌的category，在网上找了N多个方法，总结一下。
首先看了任平生的方法，详见这里，说的是把category的永久链接设置成一个点号“.”，就这么一点就是了，结果，404错误。
然后看到了网上比较流行的通过 .htaccess 修改的方法，但是，全部是301，而且网页上显示的链接还是带有 category 的，只有点击以后才能访问，详细方法见这里。
下定决心一定要找一个好的方法，看到老外的留言，试了几个插件，首先用了Top Level Categories，不行，还是404错误，接着，看到了一丝曙光，一个老外说只要用Decategorizer和Redirection搭配使用就没问题，嗯，你们现在看到的我的博客的分类永久链接使用的方法就是这种。
方法总结：

把分类的永久链接形式设置成一个点号“.”（WordPress 2.5以上才能用），但是能不能出现404错误就是你的人品问题了。
使用,htaccess的方法，具体代码：

RewriteRule ^category/&#40;.+&#41;$ http://www.yourblog.com/$1 [R=301,L]

把www.yourblog.com改成你的博客地址，这种方法的缺点是显示的还是原来的，只有点击了才会301转向，造成博客上301转向地址过多
使用Top Level Categories，只要后台激活就行，但是分类的page代码，比如http://xxx/news/page/2会变成http://xxx/news/pageid?=2这样的形式，很难看
使用Decategorizer和Redirection的组合，方法：下载上传激活Decategorizer，启用，然后下载上传激活Redirection，启用，OK，一切完毕，世界清净了。

看一下我的演示吧：http://showfom.com/wordpress/ 觉得特别有成就感，哈哈。不过有一点小BUG，生成的SiteMap里的分类的链接最后没有一个斜杠“/”，嗯，别生成分类的SiteMap吧。
文章来源：http://showfom.com/4-ways-to-remove-category-from-your-wordpress-url/
WordPress 主题 Ari (10)WordPress 主题 High Art Blog (3)Google +1 按钮 WordPress 插件 (7)WordPress主题巴士今日上线 (5)WordPress 主题 Imbalance (5)站趣新版上线 (16)WordPress 主题 tanzaku (10)通过SSH迁移WordPress博客 (13)Wordpress 主题 WP Remix (2)Wordpress 主题 Js O4w (2)]]></description>
			<content:encoded><![CDATA[<p>默认的 WordPress 地址中，分类地址总有一个 category ，看着就比较讨厌，比如 <a href="http://eachsite.org/">站趣</a> 的 <a href="http://eachsite.org/category/wordpress-course/">WordPress 教程</a> 分类地址就是 http://eachsite.org/category/wordpress-course/</p>
<p>由于我对永久链接（Permalink）比较过敏，别笑，在座的各位肯定有比我更加过敏的，所以我单篇日志的永久链接设置成/%postname%/，然后分类，总是有一个讨厌的category，在网上找了N多个方法，总结一下。<span id="more-660"></span></p>
<p>首先看了任平生的方法，详见<a href="http://rpsh.net/archives/remove-the-category-prefix-from-permalinks-on-wordpress/">这里</a>，说的是把category的永久链接设置成一个点号“.”，就这么一点就是了，结果，404错误。</p>
<p>然后看到了网上比较流行的通过 .htaccess 修改的方法，但是，全部是301，而且网页上显示的链接还是带有 category 的，只有点击以后才能访问，详细方法见<a href="http://www.wprecipes.com/how-to-remove-category-from-your-wordpress-url">这里</a>。<br />
下定决心一定要找一个好的方法，看到老外的留言，试了几个插件，首先用了<a href="http://wordpress.org/extend/plugins/top-level-cats/">Top Level Categories</a>，不行，还是404错误，接着，看到了一丝曙光，一个老外说只要用<a href="http://wordpress.org/extend/plugins/decategorizer/">Decategorizer</a>和<a href="http://wordpress.org/extend/plugins/redirection/">Redirection</a>搭配使用就没问题，嗯，你们现在看到的我的博客的分类永久链接使用的方法就是这种。</p>
<p><strong>方法总结：</strong></p>
<ol>
<li>把分类的永久链接形式设置成一个点号“.”（WordPress 2.5以上才能用），但是能不能出现404错误就是你的人品问题了。</li>
<li>使用,htaccess的方法，具体代码：

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">RewriteRule ^category<span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">.+</span><span style="color: #009900;">&#41;</span>$ http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//www.yourblog.com/$1 [R=301,L]</span></pre></div></div>

<p>把<a href="http://www.yourblog.com/">www.yourblog.com</a>改成你的博客地址，这种方法的缺点是显示的还是原来的，只有点击了才会301转向，造成博客上301转向地址过多</li>
<li>使用<a href="http://wordpress.org/extend/plugins/top-level-cats/">Top Level Categories</a>，只要后台激活就行，但是分类的page代码，比如http://xxx/news/page/2会变成http://xxx/news/pageid?=2这样的形式，很难看</li>
<li>使用<a href="http://wordpress.org/extend/plugins/decategorizer/">Decategorizer</a>和<a href="http://wordpress.org/extend/plugins/redirection/">Redirection</a>的组合，方法：下载上传激活<a href="http://wordpress.org/extend/plugins/decategorizer/">Decategorizer</a>，启用，然后下载上传激活<a href="http://wordpress.org/extend/plugins/redirection/">Redirection</a>，启用，OK，一切完毕，世界清净了。</li>
</ol>
<p>看一下我的演示吧：<a href="http://showfom.com/wordpress/">http://showfom.com/wordpress/</a> 觉得特别有成就感，哈哈。不过有一点小BUG，生成的<a href="http://showfom.com/sitemap.xml">SiteMap</a>里的分类的链接最后没有一个斜杠“/”，嗯，别生成分类的SiteMap吧。<br />
文章来源：<a href="http://showfom.com/4-ways-to-remove-category-from-your-wordpress-url/">http://showfom.com/4-ways-to-remove-category-from-your-wordpress-url/</a></p>
<ul class="related_post"><li><a href="http://eachsite.org/wordpress-theme-ari/" title="WordPress 主题 Ari">WordPress 主题 Ari</a> (10)</li><li><a href="http://eachsite.org/wordpress-theme-high-art/" title="WordPress 主题 High Art Blog">WordPress 主题 High Art Blog</a> (3)</li><li><a href="http://eachsite.org/google-1-button-for-wordpress-plugin/" title="Google +1 按钮 WordPress 插件">Google +1 按钮 WordPress 插件</a> (7)</li><li><a href="http://eachsite.org/wpus-online-today/" title="WordPress主题巴士今日上线">WordPress主题巴士今日上线</a> (5)</li><li><a href="http://eachsite.org/wordpress-theme-imbalance/" title="WordPress 主题 Imbalance">WordPress 主题 Imbalance</a> (5)</li><li><a href="http://eachsite.org/eachsite-new-wp-cms-theme-online/" title="站趣新版上线">站趣新版上线</a> (16)</li><li><a href="http://eachsite.org/wordpress-them-tanzaku/" title="WordPress 主题 tanzaku">WordPress 主题 tanzaku</a> (10)</li><li><a href="http://eachsite.org/transfer-wordpress-via-ssh/" title="通过SSH迁移WordPress博客">通过SSH迁移WordPress博客</a> (13)</li><li><a href="http://eachsite.org/wordpress-theme-wp-remix/" title="Wordpress 主题 WP Remix">Wordpress 主题 WP Remix</a> (2)</li><li><a href="http://eachsite.org/wordpress-theme-js-o4w/" title="Wordpress 主题 Js O4w">Wordpress 主题 Js O4w</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://eachsite.org/4-ways-to-remove-category-from-your-wordpress-url/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

