Support » Fixing WordPress » Getting a 404 with child pages

  • I am working on a site and I am having a problem with child pages have a 404 error when you view them.

    For example, works, works, but does not.

    If i use the default permalink settings, and make the child pages have a URL that looks like they work, but if I select the post name option the pages stop working.

    I have read all the entries in the codex as well as several posts on this forum and I still cannot get this fixed. I have tried to reset my .htacess file by selecting the default permalink settings and then switching back to the post name option which did not work. I tried deleted all the code in the .htaccess file and then rewriting it by selecting the post name option again which did not work. The mod_rewrite module is installed and enabled and WordPress has access to the .htaccess file.

    I really don’t understand what the problem is and if anyone could help me out I’d really appreciate it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I found a way to fix this, but first, I must admit I’m a novice at coding. I don’t know why or how this worked, but it did.

    The same thing happened to me all of a sudden. My all my child pages started returning 404 error pages (newly created ones and old).

    After searching, I think that it may have been because I changed my permalink structure from /%category%/%postname%/ to /%postname%/. From what I read it seems that just changing the permalinks in general can cause this kind of problem for some reason. I reset the permalinks to the default setting and the problem went away, but obviously that’s not a solution. I also changed the permissions to 666 on my .htaccess file after restoring it from a back up, and that did nothing.

    Try re-saving your permalinks (this didn’t work for me, but it worked for others)

    Try resetting your permalinks to the default setting and then changing them back to your settings (this didn’t work for me, but it worked for others)

    Third – (this worked for me)

    paste this:
    global $wp_rewrite; $wp_rewrite->flush_rules();

    into your themes functions.php, refresh your website, then delete the code.

    That is what fixed all my child pages.

    I got that from here:

    The third worked for me, too. Thanks, very helpful!

    I have the same issue.

    Putting the global $wp_rewrite; $wp_rewrite->flush_rules(); in my functions.php file and reload the page, does fix the problem.

    However if I do anything with the permalinks I have to redo this.

    WHY? oh WHY?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Getting a 404 with child pages’ is closed to new replies.