How to fix redirecting xxx.xxx.xxx.xxx.xip.io when accessing Lightsail's WordPress?

AWS
Reading Time: 2 minutes

If you access your WordPress on AWS Lightsail , you may be redirected to domain name with xip.io like below.



If you face this issue you need to fix mysql database value managed by WordPress.

Let’s take a quick explanation how to fix it.



Log in to Lightsail with SSH and enter these commands to see contents of mysql database.
The password of mysql is the same as logging in WordPress management console.

sudo mysql -u root -p
Enter password: (enter password)
use bitnami_wordpress;
select * from wp_options where option_name = 'siteurl' or option_name = 'home';



In my case it looked like this.
This is the root cause.



Let’s fix this.
To manipulate database manually can be dangerous.
There’s a useful tool named Search Replace DB, let’s use it.



Download and deploy the tool to your HTTP server by running commands.

wget https://github.com/interconnectit/Search-Replace-DB/archive/master.zip
unzip -d /opt/bitnami/apps/wordpress/htdocs/ master.zip



If you succeeded you are able to access this tool by this URL.
http://<domain name>/Search-Replace-DB-master/

If installation is OK, you will see the following screen.
Input each field.
Once you have entered all items, check again before clicking Search and Replace.
Particularly, make sure that the domain name after with is completely correct.

ItemValue
Replacexxx.xxx.xxx.xxx.xip.io
with(your domain name)
database namebitnami_wordpress
usernameroot
Pass(login password)
hostlocalhost



Click Search and Replace and you will be asked by following pop-up.
If there is no problem indeed, press OK.
If you are not sure and want to check again, press Cancel and check again.



Now database value has been fixed.

Delete this tool immedately because user name and password for mysql database flowed via internet.

rm -rf /opt/bitnami/apps/wordpress/htdocs/Search-Replace-DB-master/



Let’s see if it’s now accessible by domain name.

That’s OK!

Conclusion

How was it?

It has become much more like a blog page!

Next is HTTPS by this article!

Comments

  1. I absolutely love your blog and find most of your post’s to be just what
    I’m looking for. can you offer guest writers to write content for yourself?
    I wouldn’t mind composing a post or elaborating on a number of the subjects you write with regards to here.
    Again, awesome web site!

    • yatch says:

      Thank you for your comment!

      Well, I really enjoy writing posts to this blog page, so I can manage by myself.

      Thank you again!

タイトルとURLをコピーしました