WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] custom permalinks result in error 404 (2 posts)

  1. elihorne
    Member
    Posted 7 years ago #

    After messing around with my permalinks settings, all links began returning "404" errors, even when viewed from "manage>posts" section of wp-admin control panel.

    The goal in my case was to remove the default positioning of "category/" from the url, but maintain permalinks as domain/%category%/%postname%/.

    Tips said to visit wp-includes/rewrite.php and remove the "category/" from category_base.

    Links worked for a short period of time, but randomly resorted to all 404's. Now erasing .htaccess, or resetting permalinks to anything other than off doesn't fix anything.

  2. elihorne
    Member
    Posted 7 years ago #

    Sorry, I only made this thread because I have *MY* solution and wanted to make it searchable for people. It seems like a lot of people have been having my problem. although few mention altering the wp-includes/rewrite.php file, all the symptoms and desired permalink structure are the same.

    MY SOLUTION
    **** CAVEAT: I consider this a "hack." I altered core wordpress files to make my blog jump through my hoops. Following these instructions is done at your own risk, and may result in your blog, well, not blogging.*****

    After searching all over these forums, I stumbled upon a link to a german blog (can't find the link now) that described a secondary change to rewrite.php. After removing "category/" from category_base, run a search for "// Put them together." (without the quotes).

    There you will see a hierarchical breakdown of the rewrite rules. What is important to notice here is that $category_rewrite appears before author_rewrite, and subsequently, date_rewrite and post_rewrite. Simply moving $category_rewrite to the head of the link (i.e. search>author>date>post>category instead of search>category>author>date>post) made all my problems dissapear.

    Hope this helps people. remember: this is a hack, and unless you know what you are doing, may result in your blog breaking.

Topic Closed

This topic has been closed to new replies.

About this Topic