champak
champak

Reputation: 11

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 :

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.

Upvotes: 1

Views: 8942

Answers (6)

Mark W
Mark W

Reputation: 1

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!

Upvotes: 0

mcostales84
mcostales84

Reputation: 31

Just open your Permalinks page under Settings, and save it again. That should fix the 404 error in most cases.

Upvotes: 2

champak
champak

Reputation: 11

Thanks for helping. I got my solution from here ..

http://www.virtualmin.com/node/17048

Upvotes: 0

Rob
Rob

Reputation: 12872

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.

Upvotes: 0

Gohn67
Gohn67

Reputation: 10638

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.

Upvotes: 4

Hakan Deryal
Hakan Deryal

Reputation: 2903

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.

Upvotes: 3

Related Questions