Support » Plugins and Hacks » Removing ‘Category Base’ From Permalinks

Viewing 15 replies - 1 through 15 (of 23 total)
  • I think the solution to removing Category Base would be to have wordpress use following type of paging links:

    /?paged=2

    instead of

    /page/2/

    So the thing I would think would be the solution, is if you can set a normal folder based permalinks for everything else, including posts, categories, but just have /?paged=2 to be used instead of /page/2/

    Is it something that needs to be tweaked in rewrite.php? Could someone help me to get this workaround working?

    You can see an example on my blog:
    http://techvideoblog.com/cebit/?paged=6 works
    http://techvideoblog.com/cebit/page/6/ doesn’t work (in terms of “Previous Page”, “Next Page” and PageNavi don’t know it is on the 6th page.)

    I think if wordpress could be tweaked to use /?paged=6 instead of /page/6/ then all the people asking for it in http://wordpress.org/extend/ideas/topic.php?id=359 would also be able to use WordPress now without having to use a category base folder name.

    Removing the category base would result that WP cannot make a difference between a Page
    example.com/page-slug
    and a category archive
    example.com/category-slug
    THAT’s why it is there. Usually all the “smart” workarounds to remove it end up in broken blogs.
    You were warned…

    Yes but I never think I will name a page the same as the category. So for me it wouldn’t be a problem.

    This is how my blog works for now with http://fortes.com/2007/06/20/top-level-categories-plugin-10/ installed and %category%/%postname%/ permalink:

    http://techvideoblog.com/page/4/ – works fine
    http://techvideoblog.com/%category%/%postname%/ – works fine for blog post permalinks.

    Problematic:
    http://techvideoblog.com/pmp/page/4/paging within categories, wordpress doesn’t know what page it is on, so “previous page”, “next page” and pagenavi plugin links are incorrect, it always thinks it is on page1 of the category.
    http://techvideoblog.com/cebit/2006/ – doesn’t work

    If I manually enter these kind of URLs:
    http://techvideoblog.com/cebit/?year=2006 – works fine, and WordPress links to this for paging:
    http://techvideoblog.com/cebit/?year=2006&paged=4 – works fine.

    http://techvideoblog.com/pmp/?paged=4 – works fine including “next page”, “previous page” and pagenavi.

    So the only thing needed I think for this to work, would be to change something in WordPress so it uses ?paged=4 instead of /page/4/ while keeping all the rest of the clean permalink structure and using the TopLevel Category plugin.

    Another solution I’ve seen people use is to use following permalink structure: %category%/%postname%.html

    Quote:

    Usually all the “smart” workarounds to remove it end up in broken blogs.
    You were warned…

    I’m looking at the rewrite.php file.

    All that is needed for this to work, is a workaround to use ?paged=2 type of links instead of /page/2/.

    Usually ?paged=2 links are only used for when the rest of the permalink structure is using ?p=105 kind of page permalinks.

    I wouldn’t mind using the uglier ?paged=2 URLs for paging as long as I can have super clean category permalinks that doesn’t require to use a category base.

    You may try this if you can read german (kills the /category/ in url):
    http://www.einfach-persoenlich.de/2005-08-16/wp-wordpress-wordpress-url-design-ohne-category-ballast.html

    WWDay3

    (@wwday3)

    Moshu said:

    “Removing the category base would result that WP cannot make a difference between a Page
    example.com/page-slug
    and a category archive
    example.com/category-slug
    THAT’s why it is there. Usually all the “smart” workarounds to remove it end up in broken blogs.
    You were warned…”

    That’s a copout. Any good entity-driven database would prevent duplicate entities from being created (and the “resolved” WP slug scheme resembles an entity-driven database, even if it’s not entirely so under the covers). It is something that *should* be fixed. Page and post and any other slugs should not be allowed to be duplicated.

    If you have WordPress 2.5 you can just set the category base to “/.” (without the quotes) and it will work fine without any additional plugin.

    If you have WordPress 2.5 you can just set the category base to “/.” (without the quotes) and it will work fine without any additional plugin.

    Oh? just so easy…

    Try it for yourself if you don’t believe me. 🙂

    It works great. I’ve used it in a couple new blogs with nary an issue.

    Not sure if it would use it that way for tags. Might get some conflicts there.

    If you use it I would suggest naming your categories very carefully so you won’t conflict with a post slug in the future (probably not an issue with most blogs I’ve visited).

    Just to clarify, in the permalink editing box of a post, you would put
    /.the-slug to avoid the category base? 🙂

    Hi,

    I tried and tested (for what I can) right now this hack proposed by Scribu using as Custom Structure:
    /%category%/%postname%/
    and as Category Base:
    /.

    First problem I had:
    I had a folder named the same as a category for this reason I encountered the first error. Solution: changed the name of the folder. Easy enough!

    Second problem with the archive:
    In the home page it would go fine passing from one page to another, instead once inside the categories, it would not find page 2 (as ex). Solution: changing the Custom Structure for /%category%/%postname%.html

    I am using WordPress 2.5.1 and tested it on IE7, Firefox 2, Safari 3 (mac and windows) and Opera 9.

    With IE6 I get for the categories an url type http://www.mysite.it/./category
    still working fine though. Same thing in the sitemap.xml (created automaticaly with a plugin). I edited it by hand but obviously each time I add a new post, the sitemap xml is recreated and it goes back as it was. I don’t know if it could create problem for the search engine. I have to inform me on this one!

    I will carry on study this thing.

    Regards,

    Gaelle

    PS: sorry for my english, it is not at its best (o:

    You’re saying in IE6 it put the category base ‘/.’ in the url? Weird.

    I have 3 blogs running now using this technique, and they seem fine.I will say, however, that when it comes to sub-categories, all bets are off…

    With IE6 I get for the categories an url type http://www.mysite.it/./category

    That really is weird. I thought that the redirections are done solely through mod-rewrite, thus being browser independent. From what you say, I guess that’s not the case.

    You could try this Redirection Plugin.

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Removing ‘Category Base’ From Permalinks’ is closed to new replies.