当前位置: 动力学知识库 > 问答 > 编程问答 >

hosting - Migrating Wordpress to another host: Can't login b/c it's confused about the host!

问题描述:

It's incredible!

I've just migrated a simple Wordpress site from my usual host to my client's host. The root directory for the site used to be http://www.imagineelection.com/watamu, and now it's http://www.watamuturtles.com

The http://www.watamuturtles.com homepage loads fine, but all of the links on the page still point to the old domain. Clearly I simply need to change a setting somewhere.

But -- I can't login to the admin interface! When I login at watamuturtles.org/login.php, it redirects me to the login page at imagineelection/watamu/login.php. And when I login at imagineelection, it swaps me back to watamuturtles.

Clearly I need to manually change the base directory setting in a config file, or in the database, without access to the usual WP admin interface. Can anyone point me in the right direction?

Tx!

~S

网友答案:

These 3 sql queries always does the trick for me when migrating:

fixing site url:

UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

fixing absolute urls:

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

fixing internal linking in your content:

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');
网友答案:

Simple way to migrate WordPress: first change: WordPress address (URL) and Blog address (URL) in the old blog's settings, pointing them to new URL, then export database and them import it to new blog.

网友答案:

I found this post to be helpful too: Replace all fields in MySQL

I did the following steps:

  1. Backup your database!
  2. Search entire database in phpMyAdmin for "oldsite.com" - jot down which tables contain this string
  3. Use the code in the response listed above to generate SQL queries for search and replace on all columns of each of the tables that get generated in the output (the code at the link above doesn't replace any text - just generates the SQL queries for you to execute to do the search/replace)
  4. Run each SQL query that gets generated, which will actually replace the text
分享给朋友:
您可能感兴趣的文章:
随机阅读: