Permalinks - Adding prefix to /y/m/d/ breaks yearly archive (6 posts)

  1. beseku
    Posted 9 years ago #

    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 http://www.codeigniter.com/user_guide/general/routing.html). Would I have to have '/archives/category/category-slug/'?

  2. beseku
    Posted 9 years ago #

    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 http://www.beseku.com/ if people want reference.

  3. 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.

  4. beseku
    Posted 9 years ago #

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

  5. beseku
    Posted 9 years ago #

    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?

  6. Ajd777
    Posted 9 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic