WordPress.org

Ready to get started?Download WordPress

Forums

How to remove the "category" in the link ? (25 posts)

  1. Toucouleur
    Member
    Posted 7 years ago #

    Hi there,

    It has been a while.

    I have some trouble within my WPMU. I spent hours to find where it could come from, but without success.

    Here yu are : http://lasante.net/voyage-et-sante/

    I have an article on it for exemple : http://lasante.net/voyage-et-sante/divers/precautions-sante-tchad

    my problem is when you look for the category on the right, I have :

    http://lasante.net/voyage-et-sante/category/divers/ instead of what I'm waiting for : http://lasante.net/voyage-et-sante/divers/

    How can I remove this word "category" (both URLs works) ? On the options permalink is /%category%/%postname% an nothing write on Category base

    Please help if you can :/

    C├ędric

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Can't be done. You can change the "category" to anything you like by changing the category base in the Options->Permalinks section, but it cannot be blank/empty. It must exist so as to distinguish categories from other sorts of things like pages/posts/etc.

  3. moshu
    Member
    Posted 7 years ago #

    And if you use MU, next time please ask for assistance at http://mu.wordpress.org/forums

  4. Toucouleur
    Member
    Posted 7 years ago #

    already done moshu they asked me to post here ;)

  5. Toucouleur
    Member
    Posted 7 years ago #

    Otto why http://lasante.net/voyage-et-sante/category/divers/ work also here ? http://lasante.net/voyage-et-sante/divers/

    it seems rewrite rules still work without "category", so ?

  6. moshu
    Member
    Posted 7 years ago #

    It might work, but Otto42 explained it quite nicely:
    It must exist so as to distinguish categories from other sorts of things like pages/posts/etc.
    So?

  7. xinfo
    Member
    Posted 7 years ago #

    I wonder will th

  8. Toucouleur
    Member
    Posted 7 years ago #

    moshu, sorry for bothering, and excuse my lack in english, It was not my intention to be rude in my question.

    I understand it must exists but I Can't still understand with my both URL actually works. The page for exemple : http://lasante.net/voyage-et-sante/bienvenue/ is a page not an Article, and it also works.

    The only thing I tryed to understand is "ok it must exists, but can't we remove it, if it's not absolutly necessary ?"

    thanks again for you help

    Best regards from France, and merry christmass to you all

    ps : xinfo what "th" is ?

  9. xinfo
    Member
    Posted 7 years ago #

    Attetion moderator

    all post get ripped half you can see the same one above .when i submit my full post or reply only half post is published in this forum .

    @Toucouleur i just want to know from mod may this lead to duplicate content ?same post in different url...

  10. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    The reason it "appears" to be actually working with that URL is because you have set up your permalinks with "/%category%/%postname%". So when "divers" fails to get recognized as a page, it falls back to attempting to parse it using that permalink pattern, which sets the category and gives you something that is basically the category archive page.

    But you're not actually *telling* it that it's a category in the URL. You're only getting the category as a side effect of your normal single page permalinks. If you change that permalink string, that /divers URL won't point to the category anymore, whereas the /category/divers always will.

    Basically permalinks work in a sort of fallback mechanism. It tries to parse using one pattern, and if that doesn't work, it does another, and then another, and so on until it finds one that works. If none of them work, you get a 404 page.

  11. Toucouleur
    Member
    Posted 7 years ago #

    thanks for the answer Otto, it's a mess whatever :| but thanks for spending time to explain :/

  12. youngmicroserf
    Member
    Posted 7 years ago #

    Hi, I'm hoping Otto42 might have another look at this thread - or, of course, anyone who has a helpful idea :).

    I just upgraded to 2.1 and I realised that this category_base removal hack I had used for a year in 2.0x (in German - http://www.einfach-persoenlich.de/2005-08-16/wp-wordpress-wordpress-url-design-ohne-category-ballast.html)
    no longer works properly.

    The idea used in the hack is to change the category_base to an empty string and place the category rewrite rule at the end of the rewrite rule array, then used /%category%/%postname%/ as permalink structure.

    In 2.0x everything worked just lovely, including category feeds. However, in 2.1, where the functions in question have been moved from classes.php to rewrite.php, the hack doesn't work for feeds anymore.

    I had a quick look at the rewrite functions but I could not figure out what the problem is.

    It would be great if someone helped!

    yms

  13. youngmicroserf
    Member
    Posted 7 years ago #

    no one?

  14. youngmicroserf
    Member
    Posted 7 years ago #

    Did anyone succeed in getting the categoy-less hack to work with feeds? I'm still lost.

  15. petervcook
    Member
    Posted 7 years ago #

    After asking around and trying some stuff, I finally figured out a hack free solution:

    In your Permalinks options, set your "Custom Structure" to

    /%category%/%postname%/

    and your "Category Base" to

    /.

    I haven't tested this with feeds yet. And just FYI I'm using WP 2.1

  16. ia
    Member
    Posted 7 years ago #

    In your Permalinks options, set your "Custom Structure" to

    /%category%/%postname%/

    and your "Category Base" to

    /.

    I've seen this solution on several threads here (e.g. link - closed but might prove useful), but the response to this is: does it work with paged archives, i.e., /%category%/page/2/? I've tried it (not in 2.1) and it doesn't work. Just a heads-up. :)

  17. ia
    Member
    Posted 7 years ago #

    just found this: http://fortes.com/projects/wordpress/top-level-cats/

    removes the "category" (or whatever string you used in place of it) before the category name in the permalink.

  18. jingyuan
    Member
    Posted 7 years ago #

    thanks to everyone,i have the same problem whit Toucouleur.

    now i use the plugin"top_level_cats" which sofimi recommend,it has worked well :)

  19. blizcreak
    Member
    Posted 7 years ago #

    Solved!

    Here is the solution:

    install this plugin:
    http://fortes.com/projects/wordpress/top-level-cats/

    Use the permalink structure: /%category%/%postname%.html
    set base category as 'category' (or anything else)

    It won't work without the html on the end.

    works like a dream!

    Noel

  20. siounis
    Member
    Posted 7 years ago #

    Yes! Blizcreak got it!

  21. roxer82
    Member
    Posted 6 years ago #

    Is it posible to remove the sub categories from the URL too?

  22. whooami
    Member
    Posted 6 years ago #

    (edited)

    Ive already done it the right way -- without breaking the paging when viewing category archives.

    Just have to figure out the plugin.

  23. roxer82
    Member
    Posted 6 years ago #

    With the plugin you can remove the "category/" but is it possible to remove the subcategoryes too?
    for example is it's "movies/disney" just have "disney"

  24. whooami
    Member
    Posted 6 years ago #

    With the plugin you can remove the "category/"

    you are referring to THAT ^^ plugin up there. I am not.

    The purpose of that plugin, and the purpose of the one that I am going to make available is not to remove the category names themselves, be they parent categories or child categories, but to remove the word "category".

    In short -- no.

    atleast not using the permalink structure I have been using to test this with.

    It depends on your permalink structure whether or not the category names are even included in the permalink. So one persons experience may be different than someone elses.

    In fact, your questions make make me hesitant to even work on this --

  25. Megagents
    Member
    Posted 6 years ago #

    Use the permalink structure: /%category%/%postname%.html
    set base category as 'category' (or anything else)

    It won't work without the html on the end.

    Actually I just activated the plugin and it worked instantly, I didn't need to mess with the permalinks.

Topic Closed

This topic has been closed to new replies.

About this Topic