How to Fix WordPress Images Loading From Server IP by Updating Site URL (AWS + Bitnami)

If your WordPress site on AWS Lightsail (Bitnami) starts loading images or assets from an IP address instead of your domain, the issue is almost always incorrect WordPress URL settings.

This commonly happens on AWS Lightsail with Bitnami WordPress, especially after:

  • Cloning a site
  • Migrating environments
  • Creating a dev or staging instance
  • Restoring from a snapshot

Issue:

You might notice image URLs like this:

http://44.196.xx.xx/wp-content/uploads/...

Cause:

WordPress stores its base URLs in the database:

  • siteurl
  • home

If these are set to 127.0.0.1 or an IP, WordPress will rewrite image URLs automatically — even after you re-upload them.

How To Resolve:

1. SSH into your Lightsail instance

ssh -i "C:\Users\Name\Downloads\your_amazon_pem_file.pem" bitnami@1.1.1.1

Modify the path to where your .pem file is located. Replace 1.1.1.1 with your actual IP address.

2. Check current WordPress URLs

sudo /opt/bitnami/wp-cli/bin/wp option get siteurl --allow-root
sudo /opt/bitnami/wp-cli/bin/wp option get home --allow-root

If you see http://127.0.0.1, that’s the problem.

3. Update them to your domain

sudo /opt/bitnami/wp-cli/bin/wp option update siteurl "https://your-site-url.com" --allow-root
sudo /opt/bitnami/wp-cli/bin/wp option update home "https://your-site-url.com" --allow-root

4. Confirm

sudo /opt/bitnami/wp-cli/bin/wp option get siteurl --allow-root
sudo /opt/bitnami/wp-cli/bin/wp option get home --allow-root

Clear Cache

If you’re using Elementor, go to Elementor → Tools → Regenerate Files & Data and clear your cache.
If you’re not using Elementor, clear your WordPress cache, server cache, and any CDN cache you have enabled. This ensures no old CSS or media URLs are still pointing to the IP address.

NOTE: While this may resolve issues moving forward, existing content