WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9456 closed defect (bug) (invalid)

problem using /%category%/%postname%/

Reported by: ramiy Owned by: ryan
Milestone: Priority: high
Severity: major Version: 2.7.1
Component: Permalinks Keywords: parmalink, categories, category, reporter-feedback
Focuses: Cc:

Description

parmalink structure: /%category%/%postname%/

using nested sub-categories appear as nested directories in the URI. wordpress is dealing with those nested directories like %postname%. because we defined first directory as %category% and second directory as %postname%.

http://.../cat-news/post-name/ - works ok.

http://.../cat-news/cat-news2/post-name/ - returns 404.

Attachments (1)

wordpress-permalinks[1].gif (5.6 KB) - added by ramiy 6 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 follow-ups: @hakre6 years ago

Postname alone does not work at all. At I least with my experiences I would strongly discourage it. The %category% in front doesn't make it much better.

comment:2 @hakre6 years ago

  • Keywords reporter-feedback added

Another thought: A post has only one category. Please test against this URL:

http://.../cat-news2/post-name/

comment:3 in reply to: ↑ 1 ; follow-ups: @jbsil6 years ago

Replying to hakre:

Postname alone does not work at all. At I least with my experiences I would strongly discourage it. The %category% in front doesn't make it much better.

I strongly disagree. In fact, I have multiple blogs set up with only /%postname%/ as the permalink structure, and they all work perfectly. Just my two cents.

comment:4 in reply to: ↑ 1 @Denis-de-Bernardy6 years ago

Replying to hakre:

Postname alone does not work at all. At I least with my experiences I would strongly discourage it. The %category% in front doesn't make it much better.

+1 to that. These two are simply the worst service you could possibly do to your site. The only thing you'll get are bugs are performance problems.

And yet, an obscene amount of irresistibly incompetent SEO "experts" consistently praise those two.

Maybe we should submit a patch that actually tells this to end-users. As right there, in large, bold type, at the beginning of the settings / permalinks screen. I'm sick of fixing sites that use these broken structures.

comment:5 in reply to: ↑ 3 @Denis-de-Bernardy6 years ago

Replying to jbsil:

I strongly disagree. In fact, I have multiple blogs set up with only /%postname%/ as the permalink structure, and they all work perfectly. Just my two cents.

Lucky you. Perhaps you don't have static pages and a whole bunch of plugins around? On my end, I've had to change my customers' structure in order to fix their site... mmm... a few hundred times?

comment:6 in reply to: ↑ 3 ; follow-up: @hakre6 years ago

Replying to jbsil:

I strongly disagree. In fact, I have multiple blogs set up with only /%postname%/ as the permalink structure, and they all work perfectly. Just my two cents.

Yeah, technically spoken, it works, but you run into problems if the post names are not unique enough and anyway can catch illy side-effects (for example if the blog not placed at the root for the site etc.). so you are fine to make so, but that is why I wrote I strongly discourage it because of my experiences, I did not write that for fun.

if you're in for having a flat structure, add constants (like a dot, comma or similar) and the postid into the filename: /%postname%,%post_id%,%year%-%monthnum%.html this is informative as well.

comment:7 in reply to: ↑ 6 ; follow-up: @johnjamesjacoby6 years ago

I've used /%category%/%postname%/ often, and find it to work perfectly well. I think this is usually the best way to match the URI to the content of the entry. You can also still access the topic using the month/day URI also, it will just bounce you to the rewritten one, because the date of the topic is still correct.

Example:
http://bbpress.org/blog/talkpress-and-bbpress/
http://bbpress.org/blog/2009/04/talkpress-and-bbpress/

Both resolve to:
http://bbpress.org/blog/2009/04/talkpress-and-bbpress/

I agree that keeping your %postname%'s unique is a concern, and that using %postname% alone is tricky, but it certainly does work the way it's supposed to. If what you're asking is that %postname% checks all previous taxonomies and slugs for conflicts, that's more of a feature request in my opinion.

Back to the original bug.

If I am reading this correctly, this actually isn't a bug or a problem. WordPress doesn't use nested categories in the URI, and it never has. It uses the category first in the numeric list of all categories that it is part of, and uses that as the %category%. Even if you use a breadcrumb plugin, the breacrumb must account for the categories hierarchy even though the URI will only show one category in the URI.

Does that make sense?

comment:8 in reply to: ↑ 7 @Denis-de-Bernardy6 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Replying to johnjamesjacoby:

If I am reading this correctly, this actually isn't a bug or a problem. WordPress doesn't use nested categories in the URI, and it never has. (...)

Does that make sense?

Absolutely.

comment:9 @Denis-de-Bernardy6 years ago

  • Milestone Unassigned deleted
Note: See TracTickets for help on using tickets.