wordpress设置永久链接

日期:2007-11-03 | 作者: Allen

设置永久链接的重要性

wordpress默认的日志URL格式通常是:http://allenle.cn/?p=POSTID,显然当我看到这个URL的时候不会知道URL后面的日志是什么内容,我们需要更加有意义的URL,不仅是人类看的懂的URL,同样还可以帮助搜索引擎搜录你的日志,所以我们需要更好的URL方式。

哪里设置永久链接?

登录到wordpress后台,“设置”→“永久链接”。

怎么设置永久链接?

在“自定义结构”中填写永久链接的格式。

常用的写法有:

  1. 样式:http://www.yourwebsite.com/123.html
    写法:/%post_id%.html
  2. 样式:http://www.yourwebsite.com/archives/123.html
    写法:/archives/%post_id%.html 
  3. 样式:http://www.yourwebsite.com/2007/09/16/post-name.html
    写法:/%year%/%monthnum%/%day%/%postname%.html
  4. 样式:http://www.yourwebsite.com/2007/03/post-name.html
    写法:/%year%/%monthnum%/%postname%.html
  5. 样式:http://www.yourwebsite.com/category/post-name.html
    写法: /%category%/%postname%.html
  6. 样式:http://www.yourwebsite.com/archives/post-name.html      
    写法:/archive/%postname%.html
  7. 样式:http://www.yourwebsite.com/post-name.html      
    写法:/%postname%.html

其中比较推荐的是5、6、7三种样式,Allen现在用的第5种样式。

说明:

%year% 日志发布的年,4位数字,如:2004
%monthnum% 日志发布的月份,2位数字,如:05
%day% 日志发布当月的第几天,2位数字,如:28
%hour% 日志发布时间中的“小时”,2位数字,如:15
%minute%
日志发布时间中的“分钟”,2位数字,如:43
%second% 日志发布时间中的“秒”,2位数字,如:33
%postname%
一串处理过的日志标题。如,日志标题为“This Is A Great Post!”,那么%postname%表示为“this-is-a-great-post”
%post_id% 日志的唯一编号
%category% 日志所在的分类
%author%
日志的作者

补充阅读:

  1. WordPress官网上关于永久链接的说明(英文)
  2. wordpress永久链接的设定  来自博客观察。

也许你还会喜欢

Leave a Reply

Additional comments powered by BackType