Support » Fixing WordPress » Allow requests to bare slugs?

  • Resolved squeegily

    (@squeegily)


    On every WordPress.com-hosted site I’ve seen, I’ll observe requests to

    http://example.com/my-post-slug

    being appropriately sent to

    http://example.com/2004/07/my-post-slug/

    (in the correct format for the site)

    —how can I replicate this behavior? Is it a plugin, or a setting?

    • This topic was modified 2 years, 1 month ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • if you are hosting with wordpress.com you will need to get support from them.. you can do that here: https://wordpress.com/support/

    We only provide support to self-hosted users who have downloaded wordpress from wp.org the site this forum is housed on.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Pretty much all WordPress sites will do this by default. The redirect_guess_404_permalink function will generate such a redirect for any post slug.

    Thread Starter squeegily

    (@squeegily)

    We only provide support to self-hosted users

    agreed—I have posted this post in the correct forum; I am self-hosted.

    Pretty much all WordPress sites will do this by default

    That is…good to hear (and my impression, as well)—but—how does one enable this?

    (The first 2 pages of google for “redirect_guess_404_permalink” seem to contain exclusively technical information for WordPress’ programmers)

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    You don’t need to “enable” it, it’s there by default. Always on, as long as you’re not using “default” permalinks.

    Basically, when WordPress doesn’t know what you’re looking for, it tries to make a guess. It’s not perfect at it, but if all it has to go on is the slug and that happens to match a slug in the system already, then it will redirect you to there.

    You don’t need to do anything to turn this on, this is the default behavior. You would have to go through extra steps to turn it off.

    Thread Starter squeegily

    (@squeegily)

    You don’t need to do anything to turn this on, this is the default behavior.

    I opened this thread because that is not true*.

    The following—which is precisely my desired behaviour—is, apparently, not out-of-thebox:

    if all it has to go on is the slug and that happens to match a slug in the system already, then it will redirect you to there.

    *on my site running WordPress 5.4 on PHP 7.4.4 with “Month and name” canonical-permalinks.

    I attached the demonstration link to the original post, but I realize that may only be accessible by moderators, so I’ll post it publicly here:

    • This reply was modified 2 years, 1 month ago by squeegily.
    • This reply was modified 2 years, 1 month ago by squeegily. Reason: add tags and a linebreak
    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Near as I can tell, it works out of the box without any adjustments. I set up a local test system and it worked there first try.

    So, maybe you have a plugin or something else that disables that logic. A fair number of SEO plugins might do just such a thing.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Actually, it works out of the box on your blog too. See this link:

    http://www.ishygddt.xyz./~blog/vincent-canfield-update-1/

    Looks like you may have an extra ending period in your URLs in Settings->General. Might want to remove those.

    Thread Starter squeegily

    (@squeegily)

    Fascinating…so redirect_guess_404_permalink becomes disabled when the presence of a trailing dot in the URL disagrees with that in the site settings.

    That resolves my concern; thank you!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Allow requests to bare slugs?’ is closed to new replies.