WordPress.org

Ready to get started?Download WordPress

Forums

Which permalink structure/syntax to use? (5 posts)

  1. elektronicat
    Member
    Posted 3 years ago #

    Hope someone can help me with this issue:
    I had set the following permalink structure: /%pagename%, which worked fine, also with subpages, as the url-bar correctly displayed pagename/subpagename. However, the single posts could not be viewed; clicking on a posttitle in a (static) postpage (you know, all the posts displayed ordered by date of publishing) displayed the 404 error page. I then changed the permalink to /%pagename%/%postname%, which fixed the problem of the posts - single posts were now viewable, but then the page with subpages generated a 404 error page..

    Hence, my question is: Which permalinks structure or syntax is correct when I want to display single posts AND pages with subpages?

    For the record: everything works fine when I set the permalinks to default or 'ugly' structure or syntax.

  2. MULTIDOTS
    Member
    Posted 3 years ago #

    Hi elektronicat

    /%category%/%postname%/
    is the best permalinks structure when display single posts AND pages with subpages.

  3. extatix
    Member
    Posted 3 years ago #

    Except that the WP Codex says

    Starting Permalinks with %category% is strongly not recommended for performance reasons.

  4. elektronicat
    Member
    Posted 3 years ago #

    I see.. I won't be using categories, so just setting the permalink to /%postname% would be sufficient, and it works for both single posts and pages with subpages. The only downside with this permalink structure is that the url won't be including the parent page from where it originated from (in my case 'News') The only messy (visual) fix is to make a category named 'News' and use the /%category%/%postname%/ structure altogether. That way 'News' will be displayed, not as pagename but as categorie name.
    Unless, someone knows a cleaner, more valid, solution?

  5. extatix
    Member
    Posted 3 years ago #

    I use /%post_id%/%postname%/
    Works fine for pages with sub-pages and has the added benefit (for me) I can use a shortlink for the post like mysite.com/333/ instead of the full mysite.com/333/i-love-custom-taxonomies

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags