Wordpress - moved to new server with different URL.  Content is 404 Not Found

Posted on 2013-06-25
Last Modified: 2013-06-27
We have a Wordpress site used as a company Intranet.  It was previously accessible on the old server at http://oldserver/wordpress, and I want to move it to http://newserver/wordpress.

So I've done the following:

1. Copied all files from the /wordpress directory on the old server, to the /wordpress directory on the new server.

2. Dumped the old database to a file with "mysqldump -u root -poldpass wordpress > database.sql"

3. Created a database called "wordpress" on the new server.

4. Created a user on the new server with the same name and password as on the old server.

5. Granted all priviledges on wordpress.* to the user.

6. Imported the database with mysql –u root –pnewpass wordpress < database.sql

7. Downloaded the Search and Replace tool from, and used it to replace instances of the string "oldserver" in the database with the string "newserver".

Now when I load the page "http://newserver/wordpress" into a browser, the structure of the template appears, but I get "Error 404 - not found" where the content should be.

I can access http://newserver/wordpress/wp-admin and log in there successfully.  Under Settings | General, the Wordpress Address URL and the Site Address URL both read "http://newserver/wordpress".

Under "Pages", it reports "No pages found", although at the top of this page it says All(36)|Published(34)|Draft(1)|Private(1).

Permalink settings (which seem to be the cause of this kind of trouble for many people, it seems) are set to "Default".  I've tried changing it to something else, and back again without any joy.

There is an .htaccess file at the root of the site, but it doesn't contain anything more than "# BEGIN Wordpress", a blank line, then "# End Wordpress".

User and Group for all files in the /wordpress directory and below is "www-data".

How can I get the content to appear on the new server?  I've done a lot of Googling and there are a lot of suggestions regarding permalinks, but as far as I can see they don't apply here.
Question by:wakatashi
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +2

Expert Comment

ID: 39275995
This might have all been done a lot easier using the wordpress export tool and re-importing it to the new server? I assume it's too late to now do that?

Author Comment

ID: 39276098
Not necessarily too late, no.  I didn't think the Wordpress export tool was an option when changing URL like this though, is it?  

If so, if you could please let me know how you'd go about it, I can give it a whirl.
LVL 70

Expert Comment

by:Jason C. Levine
ID: 39276184
I didn't think the Wordpress export tool was an option when changing URL like this though, is it?  

It's not.

Check this article:

Basically you want perform the search and replace after your step 2.  The article above discusses it in detail.
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.


Expert Comment

ID: 39276508
I would go back before the search and replace operation, in the database you only need change the URL values within the wp-options table and remove the permalink entry.

Change the wp-config file which you have obviously done correctly and you should have a working site to get you started. Its always worth checking DNS aswell if it is only the homepage that is not resolving?
LVL 25

Expert Comment

by:James Rodgers
ID: 39279591
try exporting the db using wp_migrate DB, this will do a find replace on the old and new URL AND update the serialized data

Author Comment

ID: 39279707
@jason1178: I've been through the process detailed in the article, which differed from the way I did it originally, in that first time around, I did the following:

1. Copied the entire Wordpress directory and its contents to the new server
2. Dumped the database on the old server, ran the Search and Replace tool on it, and uploaded the result on the new server with the "mysql" command.

The article you linked me to suggests clean-installing Wordpress on the target server, and copying only the "wp-content" folder from the old server.  The database is handled in the same way.

But my result is, I'm afraid, exactly the same.

@ScorchD: URL in the wp-options table in the database is correct for the new server.  What did you mean by "remove the permalink entry"?  We're using the default permalink format of "http://server/wordpress/?p=123", so it's nice and simple.  In that respect, anyway!  DNS resolves to the correct IPs for both old and new server hostnames - the servers both reside on our LAN, so that's pretty straightforward too.

Author Comment

ID: 39279753
@Jester_48: Hadn't come across that plugin.  Installed and ran it, and it displayed the following error multiple times in a row:

Warning: Missing argument 1 for k2sbmModule::k2sbmModule(), called in /var/www/wordpress/wp-content/plugins/wp-migrate-db/wp-migrate-db.php on line 612 and defined in /var/www/wordpress/wp-content/themes/k2/app/classes/widgets.php on line 493

However, it did spit out a .sql file which I duly imported into the new server.  No dice though, I'm afraid - exactly the same result, darn it.
LVL 25

Expert Comment

by:James Rodgers
ID: 39282804
the k2 theme is 4 years old, what version of WP and PHP are you using?

Accepted Solution

ScorchD earned 500 total points
ID: 39282923
What I meant is clear the permalink structure from the database field, if you are able to view the admin it shouldnt be anything to serious, what I would do is turn off all of your plugins, if you strip it back to just a simple Wordpress install with communication to the database you should be able to find the issue.
Obvious question, you dont have any sort of caching plugin?

Author Comment

ID: 39282947
On the old server, it's PHP 5.2.6-1+lenny 9, WP version 3.5.1.

On  the new server, it's PHP 5.3.10-1ubuntu3.6.

I'm trying to migrate the Wordpress install exactly as is, including the theme.  The WP install is something I inherited - it's a kind of "Intranet" site - and I'd really prefer not to mess with it at all at this stage.  I just want to get it up and running on the new server unmodified if I can.

Author Comment

ID: 39282963
@ScorchD - yes, yes YES!!  Turning off all the plugins has allowed the content to be displayed.  You, sir, are a gentleman and a scholar.

It should be a simple matter of narrowing down the offending plug-in from here, so I would say that's a win.  Thank you!

And thanks to everyone else too.  I am a happy man.

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Transferring a wordpress site from a host or local dev server to another host can be a pain. So I've included my steps on how I have accomplished this task. Steps include an assumption that you have Cpanel access or Ftp access.. If you do not hav…
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and Log…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question