简体   繁体   中英

Transfer WordPress from live server to localhost

I'm trying to transfer all my files from the remote server to my localhost. I've downloaded everything from ftp and exported the database( .gzip ). I've logged in to my local phpmyadmin and changed the url in the 'wp_options' table.

My problem is that when I try to run it in the browser, it redirects to my live site.

Note: I've also deleted my .htaccess file thinking that it may have caused the redirection.

You should use the Wordpress serialized pho search replace tool, link here , to replace the live URL to the local URL. That should fix it.

Try this Plugin WP Migrate DB. It saved me hours of work, editing my databases by hand.

http://wordpress.org/plugins/wp-migrate-db/

WP Migrate DB exports your database as a MySQL data dump (much like phpMyAdmin), does a find and replace on URLs and file paths, then allows you to save it to your computer. It is perfect for developers who need to update their local install with fresh data from the production site, or copy their locally developed site to a staging or production server.

It even takes into account serialized data (both arrays and objects) and updates the string length values.

It lets you define your new doc-root and urls and provides you with a finished sql file to import on your local DB.

For a quick and dirty workaround, you could add following lines of code to your wp-config.php file. But, if you remove these lines again in the future, your change of URL will disappear too.

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

Note: This solution only works on single-install site.

More on this topic here: Wordpress Codex

You can use searchreplacedb2.php file which can download from here

http://interconnectit.com/products/search-and-replace-for-wordpress-databases/

and copy php file in wordpress root directory.

Then execute this file in browser and follow step by step process.

After export your DB to gzip, unpack the file. Replace all urls of your remote example.com with localsite.com. Pack edited to gzip again. Import it with phpmyadmin.

I think this way may help you.

go to your local admin panel and go to settings > permalinks.

and save it, then enjoy your site on localhost.

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM