WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Page links don't work on categories (5 posts)

  1. Foofy
    Member
    Posted 8 years ago #

    Using the latest version of WordPress I've set up my permalink structure for categories something like this:

    example.com/cows/

    This works fine except for the page links like example.com/cows/page/2/ just give WP's "not found" error. It works fine if my category base is something else though, like:

    example.com/categories/cows/
    example.com/categories/cows/page/2/

    At first I thought it was something wrong with the mod_rewrite stuff. If I type in index.php?category_name=cows&paged=2 it shows up just fine. I'm also pretty sure mod_rewrite is working normally. All my other rewriting rules work perfectly, and if I set it to redirect (instead of rewrite) it also works just fine.

    My guess is that somewhere along the line WordPressitself checks the actual URL given and does something screwy with it. Does anybody else have this problem? Know of a workaround? Anything?

  2. Foofy
    Member
    Posted 8 years ago #

    I fixed it! It took me a bit to understand the new way WordPress handles URL rewriting. It seems if no category base is specified (by just putting / in the option box) it sets it to "category/".

    This can be fixed by changing line 1079 in classes.php:

    $this->category_structure = $this->front . 'category/';

    To:

    $this->category_structure = $this->front . '/';

    Assuming that it is actually something that's "broken" and needs to be fixed. I'm betting there's a reason for it I'm just not aware of.

  3. Foofy
    Member
    Posted 8 years ago #

    Actually, the above code breaks everything. I'm obviously too tired to know what I'm doing.

  4. moshu
    Member
    Posted 8 years ago #

    I'm betting there's a reason for it I'm just not aware of.

    There is. If no "category base" is defined then a permalink like example.com/cows is perceived by WP as a Page!

  5. ma2t
    Member
    Posted 8 years ago #

    Foofy,

    Well, I have been searching for hours to find how to remove the category base, and I thought I would give your idea a shot, and well, it worked!.

    Seems to be fine for me so far!

    Maybe I will run into problems later, I sure hope not :/.

    I have no "pages" as such on the site, it seems that is what people were having problems with.

    http://www.celebsource.org/britney-spears/ <-- cat
    http://www.celebsource.org/britney-spears/fear-of-paparazzi-stops-britney-walking-with-baby/ <- news post
    http://www.celebsource.org/amy-lee/ <-- another cat

    Thanks :)

Topic Closed

This topic has been closed to new replies.

About this Topic