简体   繁体   中英

Wordpress Change URL after Migrating to Amazon EC2

I am doing migration of Wordpress from one Amazon EC2 instance to another Amazon EC2 instance after it is messed up. So I did the installation of LAMP from the AWS documentation. I have moved my Wordpress contents into /var/www/html . I have also prepared the database accordingly and run the .sql backup file.

But then when I go to the IP address, it just could not load. My guess is the current Wordpress is using the old IP of the instance while I now have a new IP for the new instance. How do I fix this?

So far what I did to get access into the website:

Based on https://codex.wordpress.org/Changing_The_Site_URL I have put below code in my wp-config.php file

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

But it did not work. Any guidance is highly appreciated. Thank you.

UPDATE:

Sorry for being unclear about the observation. Says my old IP was http://1.1.1.1 , and my new IP is http://1.1.1.2 . After the changes, when I try to go to http://1.1.1.2 , it just like take some times to load then suddenly it tries to bring me back to http://1.1.1.1 . And of course eventually I'll receive time out error message because old IP is no longer available.

I am using Apache web server, latest Wordpress 4.5, http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html#wordpress-troubleshooting

So I managed to find the workaround after adding the .htaccess file. To summarize, here are what I did:

  1. Put the define function in wp-config.php
  2. change WordPress site URL with the wp-cli with the help of AWS documentation http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html#wordpress-troubleshooting
  3. Put back the .htaccess file into /var/www/html and change the previous IP to current IP

Last thing I did that does the magic was clear cache in the browser . And finally my website now could be opened. Thank you for the comments above and that really help.

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