Moving wordpress site – getting 404 errors

I moved a website from a third party to an internal IP.

I unzipped the WP installation and imported the mysql DB and ran these queries :

Read More
UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');

I can see my new index.php and even login to the admin section , but I cannot get to any of the links in the pages. I get 404 errors. The admin page lists the new domain correctly.

I might be missing a .htaccess or a rewite rule and I am not sure of what to do.

Any suggestions will be much appreciated.

Related posts

Leave a Reply

6 comments

  1. Yeah, it could be your .htaccess file. You should try updating your permalinks in the WordPress admin. Switch the permalinks to the default which does not require an .htacess file, and then switch them to the one you want to use. That usually works for me.

  2. It is probably a Permalink issue.

    Checking the Permalink options from the admin panel, and comparing them with links to see if they are correct might help.

  3. What I normally do when moving a database (wordpress as well as others) is open the database dump with a text editor and search/replace all instances of the old file system path with the new file system path and the old url’s with the new url’s. This will ensure you don’t miss any tables or columns. If the database is too large to be opened with a text editor then I write a simple script to parse through it and do the replacements. Then after the replacements are made I do the import.

  4. Are you moving the site to a Windows Server????

    If you are able to see the Home page or the Admin home page, but get a 404 error when you migrate to a Windows Server, here’s how to fix that.

    The site needs some redirections for sub directories in order to resolve the request properly. The follow htaccess rules need to be imported from the URL rewrite module.

    # BEGIN WordPress
    
    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 mod_security.c>
    
    <Files async-upload.php>
    
    SecFilterEngine Off
    
    SecFilterScanPOST Off
    
    </Files>
    
    </IfModule>
    
    # END WordPress
    

    Once you paste this in the Import Rules > Rewrite Rules section, hit apply at the upper right hand corner to create the URL rewrites. You were able to confirm that the site was now working as expected. Please let us know if you have any additional questions or concerns!