I am working with a WordPress site on AWS wherein the site was mapped to a specific domain. That domain has long since been sold and canceled, so I want to change the domain to something else to access the site content.

The issue is, when attempting to navigate to the admin portal through /wp-admin or /wp-login.php or similar, the site redirects me to the naked domain which obviously fails since the DNS is no longer configured there.

Can you help me fix this issue through the Linux command line or SFTP? I feel like I have tried everything, but the site is still redirecting.

Any information you have would be appreciated, thanks.

  • You defintely would need access to phpmyadmin sql database to change the wp_options table. Commented Feb 13, 2020 at 22:59

1 Answer 1


If you have access to the database, go into the wp-options table and change the two instances of www.olddomain.com to www.newdomain.com .

You should be able to log into the admin area then.

Then use a Search and Replace plugin (I like "Better Search and Replace") to change all instances of www.olddomain.com to www.newdomain.com ) . That is required to ensure that internal links (especially to media files) will work.

Of course, a backup of your database is always a good idea.

  • Thanks for the good comment and support. I am a bit daft in terms of PHP and WordPress, and I was curious to know, how would I access the database in this case? Is there a specific database URL that I would need to know including a set of credentials? Do I use some sort of SQL browser to do this? Is there a place where this information is stored in plain text format where I can edit using SSH or SFTP? Commented Feb 14, 2020 at 22:48
  • You'll access your database via your hosting place's Control Panel, the myPHPAdmin app. You'll need to know your database name (in the wp-config.php). Inside that database is the wp-options table; 2 spots contain the site URL. There are many googles/bings/ducks on how to set those values. (Some say to set it in wp-settings.php file, but I prefer the database, where it belongs.) Commented Feb 15, 2020 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.