Want to test migrated wordpress website on new server, but it redirects to old URL

Hi Team,

I have a wordpress website, which I have migrated to a new Amazon AWS EC2 Linux Free Tier Instance.

The steps I followed are:
1. Backed up wordpress files(public_html folder) and database.
2. Installed LAMP, SSL and PhpMyAdmin on new server(followed Amazon Tutorials).
3. Copied wordpress files backup to new server under /var/www/html folder.
4. Created required database and required user on new server.
5. Edited wp-config.php with required details: dbname, dbuser, dbpassword, ...
6. Imported the backedup database file on new server.
7. Tried accessing the new url which installed wordpress.

Everything upto here worked fine.

But now, when I access wp-admin console or home page url, it redirects to the old server and instead of displaying the EC2 public DNS name in the browser address bar, the old url is displayed which I do not want (I understand I have not changed the domain mapping to the new server ip address yet.)

Because unless and until I am sure, that the site functions well on new server, I do not want to map the domain name to the new server ip address.

I want to test my site functioning on the new server without mapping the domain name to the new server ip and I want the EC2 instance public DNS to be displayed in the browser's address bar.

I have tried several ways for doing this: 
- Edited /etc/hosts with ip and EC2 public DNS name.
- Replaced old url with new url in database backup file using notepad++ as 
  well as the script on github.
- Changed the old url in .htaccess as well.
- Added certain constants in wp-config.php.
- Manually changed the url entries in database for certain tables like 
  cp_options, cp_posts, cp_postmeta

But all lead to server disconnection, phpmyadmin hangs and wp-admin also doesnt open up.

I need to stop and start the new server to access all these again.

Request you to please help me if I am missing anything or following any wrong step. 

Read more here: Want to test migrated wordpress website on new server, but it redirects to old URL

Leave a Reply

Your email address will not be published. Required fields are marked *