Category Base Removal and Category Pagination (Revisited) (21 posts)

  1. blupixelz
    Posted 7 years ago #

    I currently have a permalink structure like this:

    In other words, I want
    instead of

    However, when I attempt to access other pages from category (e.g.: http://www.thesupermelon.com/trends/page/2/), I get a 404 error.

    I've tried various plugins and hacks, and there seems to be no clean and simple solution (.html trail for example).

    I've already looked into solutions/threads such as:

    However, this site seems to be working fine with "category/postname/" structure...

    Please help!

  2. moshu
    Posted 7 years ago #

    Then ask "that" site - not here. We consider it a nonsense hack and it is not supported.

  3. fira
    Posted 7 years ago #

    My site is not just "that" site, moshu. What for kind moderator you are if you can’t be friendly. And why is it a "nonsense hack"? If I change my permalinks on my site is that illegal? And who is "we"?

    @blupixelz, send me e-mail and I will help you with your problem. You see, I can't help you here, because of "that" friendly moderator.

  4. mckinley
    Posted 7 years ago #


    Hi. I am also having the same problem. I would love to hear how you solved this. Thanks!

  5. sarmadhassan
    Posted 7 years ago #

    i had problems with this moderator in almost the same thread i started long time ago.. he acts like a crying kid most of the time.. Moshu iam sorry but we can't post problems that suits your will..

    fira and mckinley.. kindly post me a solution to this one as well..

  6. modus
    Posted 7 years ago #

    @all: Exactly the same problem i was fiddling with to no good. Please let us know, whatever the one or other 'admin' considers to be interesting or nonsensical.

    @moshu: Please moshu, reconsider your tendency to censor others thoughts.

  7. sarmadhassan
    Posted 7 years ago #

    hope somebody will post a solution soon enough !

  8. wdm
    Posted 7 years ago #

    Any news?

  9. sarmadhassan
    Posted 7 years ago #

    no there is no news.. everybody sleeping..

  10. dimospbru
    Posted 7 years ago #

    Fira, please , could you send a hack or tell where it can be found!!
    Need it a lot. Don't want to loose goodPR pages :)
    My mail dimo[dot]spb[dot]ru[AT]gmail[dot]com
    Thanks in advance!!!!

  11. soyelnacho
    Posted 7 years ago #


    a found a solution...

    as seen at http://forums.digitalpoint.com/showthread.php?t=1022546

    go to wp-includes/classes.php
    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.

    works for me :)

  12. dimospbru
    Posted 7 years ago #

    Thank you, kind sir!!!!!
    It works well :)

  13. nemonet
    Posted 6 years ago #

    Yes, thank you much.

    Im assuming when upgrading WP this will be overwriten, so CHMOD file or keep backup.


  14. desmondo
    Posted 6 years ago #

    Works for me too, thanks very much.

  15. _timk
    Posted 6 years ago #

    The pagination fails because of a rewrite rule that, in this permalink configuration, is broken. Here's the rule:

    (.+?)/([^/]+)(/[0-9]+)?/?$ == index.php?category_name=$1&name=$2&page=$3

    I'd love to know what WP function uses those three queryvars; haven't had much luck grepping for them. Looks like it's supposed to handle /cat/post/pagenum for posts spanning multiple pages. I don't have any of those, so I don't need that rule.

    And here's the one we want, which appears at the bottom of the list of rules, despite being more specific:

    (.+?)/page/?([0-9]{1,})/?$ == index.php?category_name=$1&paged=$2

    The proper way to handle this problem, if it doesn't break other parts of WP, would be to reorder the rewrite rules so that the first rule is below the second. But sdemidko's code solves my problem now, so I'll leave the research for later.

    I've dropped this into a plugin so I don't have to worry about WP upgrades:

     * workaround_broken_wp_rewrite_rule.php
     * Plugin Name: Workaround Broken WP Rewrite Rule
     * Description: Fixes pagination for /cat-slug/page/2 style URLs
     * Author: _timk
    function workaround_broken_wp_rewrite_rule($query_vars)
      if (@$query_vars["name"] == "page") {
        $qv = array();
        $qv["paged"] = str_replace("/", "", $query_vars["page"]);
        $qv["category_name"] = $query_vars["category_name"];
        return $qv;
      return $query_vars;
    add_filter('request', 'workaround_broken_wp_rewrite_rule');
  16. nemonet
    Posted 6 years ago #

    Update: Although this worked for me in the past, it does not anymore.

    I have all my category's as child's of a parent "news" category. So when using this "fix" I get 404 on all category links.

    I believe this is the reason why, and not that I am using WP 2.7 now. Not 100%

    Either way, I really need help to find a work around. If you use paypal, ill throw in a donation.

    Thanks for your help...

  17. Syam Kumar R
    Posted 6 years ago #

    If you don't want to append an extension (.html) to %postname%, the only (almost) clean workaround is to just append a hyphen.


    I tried this with WordPress 2.7 and Top Level Categories plugin and it works.

  18. tds
    Posted 6 years ago #

    After trying loads of things suggested throughout the forums, I decided to learn mod_rewrites. I got round the issue of:

    instead of

    By adding the following into my .htaccess file:

    RewriteCond $1 ^(news/page) [NC]
    RewriteRule ^(.*)$ /index.php/category/$1 [L]

    This goes immediately after the "RewriteBase /" line.

    In the lines above, you'll need to change "news" for whatever your category is called. In blupixelz example, it would be "trends"

    So my entire .htaccess file looks like this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond $1 ^(news/page) [NC]
    RewriteRule ^(.*)$ /index.php/category/$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress
  19. Remiz Rahnas
    Posted 6 years ago #

    I fixed the same issue on my blog and updated as a plugin for everyone.

    Grab here http://wordpress.org/extend/plugins/category-pagination-fix/

  20. mrjonnywood
    Posted 6 years ago #

    It seems many people are desperate to solve this issue.
    I've tried everything suggested here and nothing works, I've attempted several other 'hacks' found through Google and still no Joy.

    This is a valid issue that should be addressed by WP. To me it does not make sense that when using the /%category%/%postname%/ permalink structure (a great way to help optimise your site and posts for search engines!) the following applies to the urls:


    Category 1 (work):

    Category 2 (news):

    ....so far so good....

    Sub category of work:

    If you're going from work to work/film why does WP insist on putting '/category/' in there!! I often direct people to specific areas of my site so it makes sense to use the url for sub categories as:

    What annoys me further is that when you are reading a page from the sub-category the '/category/' in the url vanishes!!!

    If anyone has any success in resolving this matter please post it in this thread.

  21. mrjonnywood
    Posted 6 years ago #


    iDope has created a plugin that works effortlessly - "WP No Category Base"

    Can also be found in Dashboard under Plugins/Add New

    Install, activate, works!!!

Topic Closed

This topic has been closed to new replies.

About this Topic