My IP address redirects automatically to wordpress doman name

February 16, 2019 403 views
WordPress Ubuntu 18.04

I have a problem which I have not managed to find by searching. I set up my wordpress website and restored it using a backup from plugin updraft plus. I restored the old database, and now I cannot access my website. The issue is ‘The page isn’t redirecting properly’. I have tried to access it via my droplet IP address, but this keeps redirecting to the web address and the loop continues. Is there a way I can access my wordpress installation by using the IP address and prevent the redirects? I have also tried adding /wp-admin and /wp-admin.php to the end of the urls, but have had no luck. Thanks

2 Answers

Hi

Connect to the DB using phpmyadmin or via mysql CLI and change these two rows in table wp_options:

select * from wp_options where option_name in ('siteurl','home');

+-----------+-------------+-----------------------+----------+
| option_id | option_name | option_value          | autoload |
+-----------+-------------+-----------------------+----------+
|        37 | home        | https://cachoid.com/blog | yes      |
|         1 | siteurl     | http://cachoid.com/blog | yes      |
+-----------+-------------+-----------------------+----------+

Replace the domain name with your IP and that should do it.

Cheers

FYI, @unixynet is correct. You can change this with the following MySQL queries:

UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');

Ofcourse, change the “www.newurl” to the IP you would like to use.

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!