How do I move a live website to my local machine with mamp

纵然是瞬间 提交于 2019-12-24 03:17:02

问题


I am trying to move a site from a live URL to my local MAMP environment. How could I do this as I am having a real pain in the back side doing this as wp-admin keeps on redirecting me to my live site or saying certain pages don't exist.


回答1:


I'm assuming you've already copied your entire WordPress directory from your web server to your local MAMP folder.

To take care of the database and URLs, I find it easiest to export the entire DB from your web server using phpMyAdmin or similar, then run find and replace on the exported SQL file to replace your old url (http://www.yourwebsite.com/) with your MAMP url (http://localhost:8888/yourwebsite) then run the SQL script to install the database locally (I use SequelPro).




回答2:


There is a great tutorial. It's not enoght just modify the wp-config.php. You have to change all URL in the database too.




回答3:


You can also edit wp-config.php (in root dir) and add/modify these lines:

$ntz_site_url = 'http://localhost:8888/';

define('WP_SITEURL', $ntz_site_url);
define('WP_HOME', $ntz_site_url);
define( 'WP_CONTENT_URL', $ntz_site_url.'/wp-content');
define( 'WP_PLUGIN_URL', $ntz_site_url.'/wp-content/plugins');



回答4:


  • Open up your wp-login.php file, check if there is some option update:

    update_option('siteurl','http://example.com'); update_option('home','http://example.com');

  • Remove those lines, or update the addresses. Maybe this is the cause of your headaches, because it may update your database siteurl and home options everytime you access the login page.



来源:https://stackoverflow.com/questions/6240417/how-do-i-move-a-live-website-to-my-local-machine-with-mamp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!