Opened 3 years ago

Last modified 2 years ago

#14036 new defect (bug)

Post 404 errors due to a base post's name matching the Permalink option "category base"

Reported by: sniper231 Owned by:
Priority: normal Milestone: Future Release
Component: Permalinks Version: 3.0
Severity: normal Keywords: has-patch dev-feedback
Cc:

Description

When the "category base" option under Settings>Permalinks is set as a value, one can still create a post with the same value used as the new post's name and thus its permalink path. Thus, when a user tries to navigate to the post via its permalink, Wordpress thinks the user wants to access a category and gives a 404 error.

Here's an example.

Say I set my category base in Settings>Permalinks to "general." All my categories are at mysite.com/general/... Now say I make a regular post and name it "General." Wordpress automatically assigns it the permalink "mysite.com/general". So, on my menus that list this post, this will be the link. However, when a user visits this link, Wordpress is set to recognize /general/ as the category base and it gives the user a 404 error. All subposts under "General" also have a permalink that begins with mysite.com/general/ and thus are seen as categories by apache mod_rewrite and become 404 as well.

Solution: users should not be able to have base pages whose names (and thus permalinks) are exact matches to the Settings>Permalinks>Category base value.

Attachments (1)

14036.diff (1.4 KB) - added by solarissmoke 2 years ago.
For top level pages, check slug against category and tag bases

Download all attachments as: .zip

Change History (4)

Interesting - wonder if this also has bearing on the problems with multisite sub-blogs returning 404s on posts and pages (and archives, tag pages etc) due to the use of " files/ " in the default configuration and rewrite rules?

  • Milestone changed from Awaiting Review to Future Release

Correct me if I'm wrong, but:

/general as the category base, then the page /general will work. On the other hand, the page /general/sub will not work, as WP will think it is a category called 'sub'.

Something should be prevented from clashing. My guess, is unique_post_slug should make sure it can't conflict with the category base, for sub pages.

For top level pages, check slug against category and tag bases

  • Keywords has-patch dev-feedback added; permalink 404 page name removed
Note: See TracTickets for help on using tickets.