Support » Developing with WordPress » Permalinks – Adding prefix to /y/m/d/ breaks yearly archive

  • I have set my site up to use permalinks with date based URLs, so posts are at ‘/yyyy/mm/dd/post-slug’, and categories are at ‘/archives/cat-slug’, with a page, called ‘archives’, as well, available at /archives/’

    I would really like to prefix the post URL with ‘archives’ too, so a post URL or date based archive URL would be ‘/archives/yyyy/mm/dd/post-slug’ or similar and everything blog related would be in the folder archives in the URL, (makes sense in my head). However, if I set this up, any year based url, such as ‘archives/yyyy’ doesn’t work, and simply redirects to the ‘archives’ page.

    Is this possible to do, or is WordPress treating the first folder after ‘archives’ as a category, even if it is numeric, (if so, this could be resolved and is possible in PHP frameworks like CodeIgniter – see routing at Would I have to have ‘/archives/category/category-slug/’?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Would I have to have ‘/archives/category/category-slug/’?

    That still doesn’t make the ‘/archives/yyyy/’ page work as it should.

    I forgot to add, the URL is if people want reference.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    You can’t have archives be both a page and not a page, which is basically what you’re trying to do.

    What’s going on is that, since you have an archives page, when you access /archives/anything, it’s matching the “/archives” part against your pages first, and then pre-empting the rest of the matching, since it matches a page.

    Rename your archives page, or choose a different leading word for your date based archives.

    So if I remove the ‘archives’ page, what would happen when the user accesses the page without the year, eg ‘/archives/’ only?

    The answer? A 404!

    That simply doesnt make sense, because now date based archives on my site are at ‘/yyyy/’ and so on, but category based and the root archives are at ‘/archives/’ and ‘/archives/category/’.

    Either way, you’re either going to have a mis matched sitemap or a portion of your URL that fails – and I don’t know what is worse?

    What you are trying to do is tell WordPress that any thing that starts with archive is a category and at the same time is a post. The only way to do this is to create a plugin that can take the confusing mess and sort it out, but that is not advised.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Permalinks – Adding prefix to /y/m/d/ breaks yearly archive’ is closed to new replies.