Opened 16 years ago
Closed 16 years ago
#7467 closed defect (bug) (duplicate)
Pages with four digits do not get handled correctly.
Reported by: | noel | Owned by: | |
---|---|---|---|
Milestone: | Priority: | high | |
Severity: | major | Version: | 2.6.1 |
Component: | General | Keywords: | permalinks, rewrite.php |
Focuses: | Cc: |
Description
If a Page is named 2002, the slug is /2002/ which interferes with permalinks for years (sometimes).
We need to alert users of this problem if there permalink structure reflects this - like wp.com does.
Change History (4)
#2
@
16 years ago
- Keywords permalinks rewrite.php added
- Priority changed from low to high
- Severity changed from normal to major
- Version set to 2.6.1
I haven't confirmed this with anything earlier or later than version 2.6 (including 2.6.2).
This isn't just a problem with pages and years, but also with any postname that is four digits and used as a permalink element. I'm converting a site from a custom system and decided to use the unique numeric ids from the existing system as the postname in the database rather than using a date based approach with some other postname Here is the permalink structure:
/content/%postname%/
Here are some example urls:
http://www.site.com/content/1/ http://www.site.com/content/10/ http://www.site.com/content/100/ http://www.site.com/content/1000/ http://www.site.com/content/10000/
All of those work correctly except the one with four digits where postname = 1000. I can use this URL (http://www.site.com/?p=1000
) with permalinks turned off and it displays the correct post, but not the one using the custom permalink structure outlined above. Since I have about 42K posts, that means that roughly 20 percent of them return 404 not found pages.
It appears that the custom permalink structure I entered is being ignored in favor of providing a year-based permalink so...
http://www.site.com/content/1000/
...doesn't work because I don't have any posts added in the year 1000. However, I do have posts from 2007 so this displays posts from the year 2007...
http://www.site.com/content/2007/
...not post ID 2007 (postname = 2007). I hope this gets resolved in the trunk and I might be able to do it myself if someone could point me in the right direction in rewrite.php.
#3
@
16 years ago
Sorry, this problem is in 2.6.2 and I'm pretty sure it was in earlier versions of 2.6.
#4
@
16 years ago
- Milestone 2.7 deleted
- Resolution set to duplicate
- Status changed from new to closed
See #5305, The plugin listed there might be helpful too
And just as an aside, If your post ID's are the same as the number in all cases, You'll be FAR better off performance wise to use /content/%id%/ (Or %postID% whatever that tag is) as it'll require less MySQL hunting for the actual result (Much easier to sort on an Int than a text field)
Confirming (in 2.6)
Affect manifests if you operate, e.g. a /%year%/%postname%/ structure or any structure that starts with /%year%/
The Pages called 2002, 2003 etc. then show as 404 errors, unless there is an entry in that year, in which case you get the year archive.