Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 455
  • Last Modified:

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

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
wakatashi
Asked:
wakatashi
  • 5
  • 2
  • 2
  • +2
1 Solution
 
TunerMLCommented:
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
 
wakatashiAuthor Commented:
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
 
Jason C. LevineNo oneCommented:
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
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

 
ScorchDCommented:
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
 
James RodgersWeb Applications DeveloperCommented:
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
 
wakatashiAuthor Commented:
@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
 
wakatashiAuthor Commented:
@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
 
James RodgersWeb Applications DeveloperCommented:
the k2 theme is 4 years old, what version of WP and PHP are you using?
0
 
ScorchDCommented:
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
 
wakatashiAuthor Commented:
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
 
wakatashiAuthor Commented:
@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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now