how to have example.com/CatName/ instead of examp (3 posts)

  1. beleg
    Posted 12 years ago #

    I don't know if it's the right place to post it ...
    I would like to know if it will be possible in the future to tweak the permalink for categories in addition of the permalink for posts ...
    I'm currently using octolan.com/blog/year/month/day/ID-ThePostName , and I would like to use octolan.com/blog/CategoryName/ID-TehPostName in addition of the first one ...
    Is it actually possible or will we see this feature in the future ?
    anyway, developpers are doing an awesome work, please continue ;)

  2. Ryan Boren
    WordPress Dev
    Posted 12 years ago #

    Just change the RewriteRule from:
    RewriteRule ^archives/category/?([0-9a-z-]+)?/?$ /weblog/index.php?category_name=$1 [QSA]
    RewriteRule ^category/?([0-9a-z-]+)?/?$ /weblog/index.php?category_name=$1 [QSA]
    You can keep them both if you like. This would give you, for example:
    where general is an example category name.
    Having /general/ is another story. That would be require some regex gymnastics to prevent /random-category-name/ from screwing with /archives/ and other things dangled from the root.
    octolan.com/blog/category/CategoryName/ID-ThePostName is doable, but the CategoryName isn't necessary since it won't really contribute anything to the generated search. ID-ThePostName, since it contains the ID, will specify exactly one post. The category is inconsequential in that case. Now, .../CategoryName/ThePostName/ might resolve to more than one post if you happen to have more than one post with the same name in a given category. That's why year/month/day is used. Having the same name on a given day is far less likely.
    Anyway, RewriteRules can accomplish all of this. Just keep in mind that regex matching a category name or anything else directly off of the root is more complicated. Your regexes need to be anchored at the head by a fixed string, typically an extra directory in the hierarchy. Ex: /archives/, /category/, /etc/, ...

  3. beleg
    Posted 12 years ago #

    ok, thank you very much for your explanation =)
    I think i'll stick with octolan.com/blog/cat/CategoryName ...
    Anyway, this wasn't a big point ... If I can't have the solution I imagined, let's do with what's possible ;)

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.