重写字preSS“博客归档的URL结构 [英] Rewrite Wordpress' Blog Archive URL structure

查看:136
本文介绍了重写字preSS“博客归档的URL结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我的网站上的档案页面列表被显示为:

Currently, my website's archive page lists are displaying as:

example.com/2012/05

example.com/2012/05

我想的URL结构改变为:

I would like to change the url structure to:

example.com/blog/2012/05

example.com/blog/2012/05

我已经与重写组合使用重定向的尝试,但我不知道这工作得很好。 我也只是试图做一个简单的重写像

I've tried using Redirects in combination with rewrites but I am not sure that works well. I've also just tried to do a simple rewrite like

重写规则^([0-9] +)/([0-9] +)/ $ /博客/ $ 1 / $ 2 [L]

RewriteRule ^([0-9]+)/([0-9]+)/$ /blog/$1/$2 [L]

捕捉/年/月的URL,并将其转换,但我没有成功。

to capture /year/month urls and convert them but I am unsuccessful.

我知道如何编辑存档导航菜单prePEND的博客/ URL的其余部分之前,但我不能让这个重写链接到页面正确

I know how to edit the archive navigation menu to prepend a blog/ before the rest of the url, but I can't get this rewrite to link to the page properly

这不是一个子文件夹。预先感谢您的帮助。

It is not in a subfolder. Thank you in advance for your help.

推荐答案

有一个真正的轻松办法做到这一点......

There is a real easy way to do this...

下的设置>永久链接,更改

Under the SETTINGS > PERMALINKS, change

  /%year%/%monthnum%/%postname%/

  /blog/%year%/%monthnum%/%postname%/

注意,您的主页将不会对/博客/。如果你想,你需要创建一个名为博客页面,并更改您的帖子页的设置>阅读,您所创建的博客网页。更多关于这里: HTTP://$c$cx.word$p$pss。组织/ Creating_a_Static_Front_Page

Note that your homepage will not be on /blog/. If you wanted that you will need to create a page called 'Blog' and change your 'Posts page' under SETTINGS > READING, to the 'Blog' page you created. More on that here: http://codex.wordpress.org/Creating_a_Static_Front_Page

这篇关于重写字preSS“博客归档的URL结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆