[wp-hackers] Putting post into /blog/

Mike Schinkel mikeschinkel at newclarity.net
Sun Nov 29 00:32:07 UTC 2009

Hi all:

> <mikeschinkel at newclarity.net>wrote:
>> Here's another URL related issue.  For the longest time I've wanted to move
>> everything blog related (i.e. not "Pages") including tags, categories, and
>> posts under the "/blog/" URL path.  Let me explain with hypothetical URLs:
>> example.com/products/
>> example.com/support/
>> example.com/about/
>> example.com/contact/
>> example.com/blog/
>> example.com/blog/category/{category_slug}/<http://example.com/blog/category/%7Bcategory_slug%7D/>
>> example.com/blog/tag/{tag_slug}/<http://example.com/blog/tag/%7Btag_slug%7D/>
>> example.com/blog/{year}/{month}/{post_slug}/<http://example.com/blog/%7Byear%7D/%7Bmonth%7D/%7Bpost_slug%7D/>
>> You'd think this would be easy but unfortunately it has been a very elusive
>> beast.

Thanks for all the comments and suggestions.  Turns out the solution is to do the following (I'm hoping this doesn't break anything, but if so I'll document):

1.) Create a "Page" called "Blog", give it a URL slug of "blog"
2.) In Settings/Reading set Front Page Display to "A static page" and set the Posts page to the "Blog" page
3.) In Settings/Permalinks set to these (or similar):

	Posts      => /blog/%year%/%monthnum%/%postname%/
	Categories => blog/categories
	Tags       => blog/tags

What threw me was that 1.) Matt didn't suggest this solution and 2.) the fact that the "Posts page" ignores the content and the page template for that page; that was just counter intuitive for me so I didn't think to look there.  Curious when that was added; I'm pretty sure it wasn't always there in version 2.x, right?

Anyway, problem solved. 


On Nov 28, 2009, at 10:20 AM, scribu wrote:

> On Sat, Nov 28, 2009 at 4:46 PM, Mike Schinkel
> I've encountered this problem before.
> Something that kind of works is adding /blog/ in the post permalink
> structure, in the admin:
> /blog/%year%/...
>> I met Matt at WordCamp Birmingham and he proposed a(n ugly) hack. The hack
>> required moving everything index.php and wp-config.php into a /wp/
>> subdirectory and then in index.php I changed the require link to:
>> require('./wp/wp-blog-header.php');
>> And added this in wp-config.php:
>> define('WP_SITEURL', 'http://example.com/wp' <http://example.com/wp%27>);
>> It worked, except for it broke the media uploads (I didn't learn that until
>> much later, and who knows what else it breaks?)
> I wouldn't call that a dirty hack, but it doesn't adress your issue.
> It simply allows you to have all the WP files in a different directory.
> -- 
> http://scribu.net
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list