Solved

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

Posted on 2013-06-25
11
440 Views
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 http://interconnectit.com/products/search-and-replace-for-wordpress-databases/, 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.
0
Comment
Question by:wakatashi
  • 5
  • 2
  • 2
  • +2
11 Comments
 
LVL 9

Expert Comment

by:TunerML
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?
0
 
LVL 1

Author Comment

by:wakatashi
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.
0
 
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:

http://www.experts-exchange.com/Web_Development/Blogs/WordPress/A_10258-How-To-Move-A-WordPress-Site.html

Basically you want perform the search and replace after your step 2.  The article above discusses it in detail.
0
 
LVL 4

Expert Comment

by:ScorchD
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?
0
 
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
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 1

Author Comment

by:wakatashi
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.
0
 
LVL 1

Author Comment

by:wakatashi
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.
0
 
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?
0
 
LVL 4

Accepted Solution

by:
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?
0
 
LVL 1

Author Comment

by:wakatashi
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.
0
 
LVL 1

Author Comment

by:wakatashi
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.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In Part I (http://www.experts-exchange.com/Web_Development/Blogs/WordPress/A_8410-Getting-Started-In-WordPress-Part-I.html), I introduced you to the powerful WordPress backend, the WordPress administrative Dashboard.  In Part II, I will introduce yo…
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now