July 4, 2007
wordpress的永久链接用的人越来越多了, 特别是在 wordpress 后台如此方便的切换永久链接之后。
不过有了这个永久链接之后, 其他的烦心事也就出现了。 比如地址不唯一啦, 更换永久链接格式之后, 原先的链接无法切换到新链接出现404错误啦等等, 因此一系列用来改善这种情况的插件应运而生, 其中最著名的三款wordpress永久链接插件是:
Permalink Redirect http://fucoder.com/code/permalink-redirect/
Dean’s Permalinks Migration http://www.deanlee.cn/wordpress/permalinks-migration-plugin/
Redirection http://urbangiraffe.com/plugins/redirection/
关于这几款插件的各自的作用和区别, 请看这里 我的WordPress这样SEO (4)-URL的友好设置及插件 、Permalink Redirect与Dean’s Permalinks Migration的一点区别 。 不过说明一点, 现在 Permalink Redirect 也可以实现 Dean’s Permalinks Migration 的功能了。
不过今天我们要聊的是另一款插件 — Redirection , 该插件功能非常强大, 可以实现你想要的任意的效果, 而这一切你只要简单的设置 Redirection 就可以了, 再也不需要去写繁琐麻烦的 Apache Rewrite 了。
这款软件的使用方法我不说了。
英文版的请看主页: http://urbangiraffe.com/plugins/redirection/
中文版请看这里: http://www.osxcn.com/wordpress/permalink-redirect.html
我今天就举个例子来说明这个软件的强大和简单。
前两天, 我发现Google的sitemap管理中有404的错误, 这种样子的网址无法找到: http://blog.2i2j.com/date/2007/04/ , 我看了很奇怪, 这种网址应该就是日志的按月分类啊, 我自己手动试了一下, 还真的发现是无法找到。 然后我到我的博客直接点archive中的按月分类, 发现正确是应该是这样的: http://blog.2i2j.com/2007/04/。 这个东西不知道是什么时候发生变化的先不管了, 当前紧要的是先把这个错误的404给重定向过来, 想到重定向那就先想到Apache的Rewrite, 可我以前从来没有写过。 结果我在自己的机子上拼命试验, 在折腾了半天之后总算写出了一个简单的要命的句子:
RewriteCond ^/date/.*$
RewriteRule ^date/(.*)$ /$1 [R=301,L]
可就是这么一个简单的语句把我折腾了半天, 我终于发现了自己是多么的笨, 而且这个Rewrite不是我等凡人能够使用的。
此事就这么告一段落, 后来我在试验 Redirection 中发现要实现上面这么一个功能是如此的简单。 在 Redirection 的后台进行如下设置就可以实现你想要的功能了。 请看图:
当然 Redirection 的强大功能并不是只有这么一点, 还有其他很多地方可以帮你实现各种你想要的功能, 具体我不再展开,如果你有心去用, 等你用的时候再慢慢发掘吧。
在文章结束的时候, 我把官方的介绍copy一些过来, 也可以让你更了解这个插件。
Redirection is a WordPress plugin to manage 301 redirections, keep track of 404 errors, and generally tidy up any loose ends your site may have. This is particularly useful if you are migrating pages from an old website, or are changing the directory of your WordPress installation.
New features include:
- 404 error monitoring - captures a log of 404 errors and allows you to easily map these to 301 redirects
- Custom ‘pass-through’ redirections allowing you to pass a URL through to another page, file, or website.
- Full logs for all redirected URLs
- All URLs can be redirected, not just ones that don’t exist
- Redirection methods - redirect based upon login status, redirect to random pages, redirect based upon the referrer!
- WordPress 2.1+ only
Existing features include:
- Automatically add a 301 redirection when a post’s URL changes
- Manually add 301, 302, and 307 redirections for a WordPress post, or for any other file
- Full regular expression support
- Apache .htaccess is not required - works entirely inside WordPress
- Strip or add www to all your WordPress pages
- Redirect index.php, index.html, and index.htm access
- Redirection statistics telling you how many times a redirection has occurred, when it last happened, who tried to do it, and where they found your URL
- Fully localized
如果你正在使用这款插件, 有什么想法和建议, 欢迎给我留言!
您喜欢本文吗?即刻订阅"偶爱偶家",精彩文章不再错过!现在就给我们留个话吗?


19 responses to "Redirection - 让wordpress转向随心所欲"
先收藏了,这两天捣鼓这些七七八八的太多,现在看到这些代码啊什么的就头大 。。。。=)
[Reply]
我在用 Permalink Redirect
[Reply]
用Permalink Redirect的人比较多, 我也用着呢, 简单的实现了最需要的网址唯一化功能.
[Reply]
发现我的sitemap里报错的都是/xxx.html/feed/ ,估计是之前换了链接结构导致的,链接结构用permalink redirect解决了,feed似乎没办法的吧。不过好像无伤大雅
[Reply]
也可以的吧. 只要知道你当前的feed地址, 把原来的那个xxx.html/feed转向转向过来就ok了. 你怎么会有xxx.html/feed/这种feed的呀? 单篇文章的feed? 我怎么没有呢?
[Reply]
其实是单篇文章评论的feed。。。
我本来的结构:/%year%/%monthnum%/%day%/%postname%/
现在的结构: /%year%/%monthnum%/%postname%.html
后面再来个feed,该怎么改呢?
[Reply]
这个应该是可以改的. 告诉我你404错误的地址. 我来帮你写一个看看
[Reply]
好多啊,我一直使用yo2的服务,人家有啥插件我就用啥!
[Reply]
是不是因为搜索引擎保存了你们以前的地址形式,而你们改了链接,所以要重定向?我好像一直是这样的,应该不会用到吧?
[Reply]
没有更改过也使用Permalink Redirect 将地址唯一化比较好,其实也没那么多讲究的,都是别人建议的。
[Reply]
是这个道理, 可能用过不同类型的永久链接, 就需要用到这个了
[Reply]
这个插件功能自定义程度高,但使用不是那么简单,我用了一个Permalink Redirect。
[Reply]
这个插件我也一直在使用,很方便。
关于你在我的”新手博客常犯的9个错误“这篇文章中的问题,我又详细讲述了我的观点,希望你能够在给一些建议。
[Reply]
哦?这么早的文章我今天才收到 pingback ?呵呵。
[Reply]
嘿嘿, 估计那时候网路不好没ping, 昨天刚好修改了一下就ping过去了. 呵呵
[Reply]
把/%year%/%monthnum%/%day%/%postname%/修改成
/%postname.html%
要怎么写?
[Reply]
/[0-9]{4}/[0-9]{2}/[0-9]{2}/(.*)/
/$1.html
应该是这样吧. 你可以试试, 不知道是不是对
[Reply]
这个插件到现在我也不会用,所以今天更新完就停用了。
你的网站可以加个小插件直接在这个网页增加新的留言而不用重新转到这个页面,但插件名字我忘了,你可以搜索一下
[Reply]
http://www.6inchboot.com/
UGG boots;cheap UGG;UGG classic
[Reply]