1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Removing Category Base In Wordpress.. Really a Challenge..!

Discussion in 'WordPress' started by sami1255, Sep 11, 2008.

  1. #1
    until now.. there exists no problem that you wont find solution on the internet.. but here comes in one..

    How to remove Category Base (\category) from Wordpress without disturbing the pagination..

    The gurus of wordpress would definitely know what am speaking about :)
     
    sami1255, Sep 11, 2008 IP
  2. sami1255

    sami1255 Well-Known Member

    Messages:
    835
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    125
    #2
    nobody into wordpress han? lol
     
    sami1255, Sep 11, 2008 IP
  3. deluxdon

    deluxdon Catch Me If You Can...!!!™ Staff

    Messages:
    25,480
    Likes Received:
    1,943
    Best Answers:
    32
    Trophy Points:
    480
    #3
    Are you looking for something like this :confused: Sorry but i can't understand your question properly.

    Category base removal plugin

    DON.
     
    deluxdon, Sep 11, 2008 IP
  4. Hoster1983

    Hoster1983 Active Member

    Messages:
    500
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Use the Category Killer Plugin for Wordpress. Search for it on Google.....It works without spoiling your current setup...
     
    Hoster1983, Sep 11, 2008 IP
  5. sami1255

    sami1255 Well-Known Member

    Messages:
    835
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    125
    #5
    sami1255, Sep 12, 2008 IP
  6. godsofchaos

    godsofchaos Peon

    Messages:
    2,595
    Likes Received:
    124
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The category base plugins all works wonderfully, but for all of them you have to fix the htaccess because these plugins fixes your blog and not your blog's other plugin. So do that. Htaccess rule and you should be fine. :)
     
    godsofchaos, Sep 12, 2008 IP
  7. Hoster1983

    Hoster1983 Active Member

    Messages:
    500
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #7
    Totally agree. I use the category Killer plugin and it works perfectly. You can change the permalink to whatever format you want your post URL to appear, just edit the .htaccess to disallow the agents to access the url structure you don't want to appear on the search results....
     
    Hoster1983, Sep 12, 2008 IP
  8. sami1255

    sami1255 Well-Known Member

    Messages:
    835
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    125
    #8
    you saying this is working fine? there are hundreds at wordpress forums shouting for solution..

    Categories pagination DONT WORK with category base removed.. i repeat that !
     
    sami1255, Sep 12, 2008 IP
  9. sdemidko

    sdemidko Member

    Messages:
    81
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #9
    Hey, I found solution, it is work for my blog
    I use latest WP 2.6.?
    I tried to use few hacks, but it didn't worked well for me, so...
    if you did managed with 'category' in your permalinks, this is for pagination:

    go to wp-includes/classes.php
    find
    if ( isset($error) )
    $this->query_vars['error'] = $error;

    under it you need to place the following

    if (@$this->query_vars["name"] == "page")
    {
    $tmp_ar = $this->query_vars;
    $this->query_vars = array();
    $this->query_vars["paged"] = str_replace("/", "", $tmp_ar["page"]);
    $this->query_vars["category_name"] = $tmp_ar["category_name"];
    }

    Thats it.

    Note. I don't use any of the hacks. My structure is '/%category/%postname/'
    and the category bsae is set to blank.

    This was hard to find and analyse, so if you have problem with (!!! only) removing 'category' from archives - pm me.
     
    sdemidko, Oct 11, 2008 IP
  10. trismegustus

    trismegustus Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I implemented this code and it did not work. My Custom Structure is /%category%/%postname%/, and my Category Base is blank.

    But here's a curious thing. Even before I modified the code, I noticed that I could go directly to the desired URL. For instance mydomain/sports/ works just as well as mydomain/category/sports/. Great, but the links in the posts that lead to the category pages all contain that unwanted "/category/" thing.

    If the desired URLs already work, why not just change the link target for category pages? (not sure of the terminology, but I hope my meaning is clear)

    Thank you!

    Trismegustus
     
    trismegustus, Nov 15, 2008 IP
  11. trismegustus

    trismegustus Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    sdemidko graciously replied to a private message to say: "First, you have to sure your ".htaccess" file in website root directory has 777 rights. Then you need to change the code in classes.php like I said in thread. And then play around you category base - try to set different bases (".", blank or "/")
    Try few combinations and it should work"

    Here are my findings:
    - blank does not work at all, "category" still appears in the URL for a category archive page
    - / will not save (saves as blank, so same results as above)
    - /. will not save (saves as .)
    - . works! except for subcategories (404 error)

    and I must say I'm not too keen on hacking base WordPress files every time I have to upgrade. Am thinking of dumping WordPress before I even get my project off the ground.

    Thanks!

    Trismsgustus
     
    trismegustus, Nov 16, 2008 IP
  12. BruceW4yne

    BruceW4yne Member

    Messages:
    55
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    48
    #12
    Thanks for the fix!

    You might also want to add the following In your .htaccess file to redirect your old /category/ URLs

    RewriteRule ^category/(.+)$ http://www.domain.com/$1 [R=301,L]
    Code (markup):
     
    BruceW4yne, Dec 21, 2008 IP
  13. Pixelrage

    Pixelrage Peon

    Messages:
    5,083
    Likes Received:
    128
    Best Answers:
    0
    Trophy Points:
    0
    #13
    I don't think this is a safe thing to do. For starters, that Category Killer plugin can cause major issues with Wordpress (read the comments on the script's homepage). Secondly, what are you going to do when Wordpress gets a major upgrade? It's going to overwrite all of the code you're putting in to removing the /category/, and all of the existing stuff you have on your site is going to get broken.

    For the life of me, I don't know why the makers of Wordpress force us to use a default category name instead of just treating it like a Wordpress Page.
     
    Pixelrage, Dec 22, 2008 IP
  14. anstar

    anstar Greenhorn

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #14
    After doing this things the categories rss feeds will be unreachable (/category_name/feed for each category_name will point to 404) - do you now how to fix this?
     
    anstar, Mar 2, 2009 IP