Wordpress Redirects to a cancelled domain, need to change it but can't get to the admin portal

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.

Topic dns ssh domain wp-admin Wordpress

Category Web


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.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.