Having Posts in Subdirectory While Rest in Root

I have tried for some time to make following: having WordPress installed in a root of host (like example.com) and having content below root (like example.com/page, or example.com/custom-post-type/entry), while having blog posts in special directory (like example.com/blog). This is needed when blog is not main type of content on WordPress powered website, but instead is just one part of a site. Example of usage is having a company website where pages are used for usual static content while there is blog or news section where updates are posted.

At first, this seems easy to achieve. Just change permalink structure on Settings → Permalinks page to something that starts with /blog/ (or whatever subfolder we want to use) as some people (and Codex entry) already suggested.

But there is a problem with this approach: your blog posts will be in your chosen subdirectory but blog’s index and paged pages won’t. This means that you wouldn’t see latest posts by going to blog’s subdirectory (example.com/blog), but instead only by going to front page (example.com).

Solution for this is very easy and I couldn’t believe how I didn’t remember it. I found it on WarriorForum, posted by user Dan Sherman. You simply need to create two empty pages and go to Settings → Reading page and choose those two pages as “Front page” and “Posts page”. Then you go to Settings → Permalinks and choose your new permalink structure.

What is important to remember is to give a name to page that should be chosen for “Posts page” with the same name as you want to name your subdirectory. Also note that for front page you need to either create content as you would for any page, or to use special page template.

Below is a video from WordPress.tv on how to create and setup “Front page” and “Posts page”.

Leave a Reply

Comment Guidelines:
  • Your email address will not be published
  • Fields marked with * are required
  • If you want your picture next to comment, open an account at Gravatar
  • If you want to know if someone replied to your comment, check “Notify me of followup comments via e-mail”
  • You can use these HTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>