Support » Fixing WordPress » 404 on all WordPress pages

  • Resolved rhiannon-ppl

    (@rhiannon-ppl)


    When I first set up this multisite installation, I set it up so that the main site of the installation was a static page to avoid disturbing our existing site. I did this using a theme containing an index.php which linked to the existing static pages. I’ve been preparing a new site in the background and now I’m trying to replace the static page with the new WordPress site.

    I exported the site I’d been creating, and imported all the pages and posts into the main site. I then changed the theme from the static-page theme to the one I wanted to use. I was expecting that this would make the new site public. However, not only is it still showing the old page, but all the other sites are now giving 404s.

    Restoring the .htaccess from backup doesn’t seem to help. Reverting the theme doesn’t help either. I must have accidentally changed something else, but no idea what! Any suggestions?

Viewing 6 replies - 1 through 6 (of 6 total)
  • luckdragon

    (@luckdragon)

    did you accidentally change the way your permalink structure is setup? or maybe you just need to set the permalink structure.. sometimes turning it off and then back on fixes the 404 issues

    rhiannon-ppl

    (@rhiannon-ppl)

    Thanks for your suggestion! I’ve tried changing the permalinks (on all sites) with no effect. Anything else I can try?

    rhiannon-ppl

    (@rhiannon-ppl)

    Oh, and I’ve also tried restoring the mysql database from backup, and that didn’t help either.

    rhiannon-ppl

    (@rhiannon-ppl)

    Ah, this might be a clue:

    I had a line in .htaccess to redirect index.html to index.php (to cope with some people’s old bookmarks to an old static page). Without it, I should expect a 404 for the non-existent index.html. But if I take it out, I actually get a 404 for index.php. Which means the redirect is still happening. Which suggests that there’s some other .htaccess file or something somewhere?

    rhiannon-ppl

    (@rhiannon-ppl)

    OK, it looks from the error logs as if all requests are being redirected to index.php in my home directory (public_html/index.php).

    I don’t see anything that would do this in my .htaccess:

    # These bits make WordPress ignore the specified password-protected directories
    
    ErrorDocument 401 /failed_auth.html
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^/(client1|client2|client3|client3|(news|services|careers|clients)\/files|failed_auth\.html).*$ [NC]
    RewriteRule . - [L]
    </IfModule>
    
    # Redirect old intranet bookmarks
    # 301 Redirect Old File
    # Redirect 301 /intranet/index.html http://www.mysitename.co.uk/intranet/index.php
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    </IfModule>
    # END WordPress
    rhiannon-ppl

    (@rhiannon-ppl)

    Aha, figured it out. There was supposed to be an index.php in the home directory, containing calls to WordPress functions, but it didn’t exist. Restored it and all works fine again.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘404 on all WordPress pages’ is closed to new replies.