#14036 closed defect (bug) (worksforme)
Post 404 errors due to a base post's name matching the Permalink option "category base"
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0 |
Component: | Permalinks | Keywords: | has-patch |
Focuses: | 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)
Change History (6)
#2
@
14 years ago
- 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.
#4
@
11 years ago
- Milestone Future Release deleted
- Resolution set to worksforme
- Status changed from new to closed
Tested in 3.8.1, no longer appears to be an issue. Tested in single site and multisite, and with posts and pages. Post, page and category permalinks all work as expected.
#5
@
11 years ago
- Keywords dev-feedback removed
Could not reproduce neither in 3.0 (when the ticket was created) nor in current trunk.
My steps:
- Set permalink structure to
/%postname%/
. - Changed category base to
general
. - Created a post named "General".
- Successfully opened the post on the front-end.
- Repeated steps 3 and 4 with a page instead of a post.
I can only reproduce the 404 error if there's a deleted page with the same name as the post. See #21970 for that.
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?