Skip to content

Help Needed: Static IP Not Redirecting to Domain in WordPress (Bitnami, Lightsail)

0

Hello AWS Support, I am New to the AWS Please Help

I have a WordPress site hosted on AWS Lightsail using Bitnami. My domain is: https://iitjeenotespdf.com My static IP is: https://13.203.32.61

I’ve successfully installed SSL using Let's Encrypt, and my domain works perfectly with HTTPS. However, when I open my static IP directly (https://13.203.32.61), it still loads the WordPress site but shows "Not Secure" and does not redirect to the Main domain.

I want any request to the static IP (HTTP or HTTPS) to automatically redirect to https://iitjeenotespdf.com, for both user safety and SEO But its not Happening.

I’ve tried editing Apache config (bitnami.conf) but I’m unsure what exactly to do under the <VirtualHost default:443 or 80> block for this redirection Or Any thing else I have to do.

Could you please help me configure it correctly? Image attached Below!!

Thank you so much for your support 🙏 Regards,

Image 1 Image 2 Image3 Image 4

asked 3 days ago47 views
1 Answer
1

To redirect your static IP address to your domain name in your WordPress Bitnami installation on Lightsail, you'll need to modify your Apache configuration files. Here's how to set up the redirection:

  1. Connect to your Lightsail instance via SSH.

  2. Access the root user (if needed) to edit the configuration files.

  3. Before making changes, it's recommended to back up your virtual host file.

  4. Open the WordPress virtual host configuration file:

sudo vi /opt/bitnami/apache/conf/vhosts/wordpress-vhost.conf
  1. In this file, you'll need to add a rewrite rule that redirects requests from your static IP to your domain name. Look for the VirtualHost section and add or modify the rewrite rules to include:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^13\.203\.32\.61
RewriteRule ^(.*)$ https://iitjeenotespdf.com$1 [R=301,L]
  1. You should also check the bitnami.conf file at /opt/bitnami/apache/conf/bitnami/bitnami.conf and ensure it has the proper redirect configuration.

  2. After making changes, check the Apache syntax to ensure there are no errors:

sudo /opt/bitnami/apache/bin/apachectl -t
  1. If the syntax check passes, restart Apache to apply the changes:
sudo /opt/bitnami/ctlscript.sh restart apache

This configuration will ensure that any requests to your static IP address (both HTTP and HTTPS) will be permanently redirected (301 redirect) to your domain name, which is better for SEO and user experience.

If you're still experiencing issues after making these changes, you might also want to check your WordPress settings to ensure that both the WordPress Address (URL) and Site Address (URL) in your WordPress General Settings are correctly set to your domain name (https://iitjeenotespdf.com).
Sources
Redirect static IP to site URL | AWS re:Post
Lightsail WordPress Instance - Incorrect HTTP to HTTPS Redirect (302 instead of 301) | AWS re:Post

answered 3 days ago
EXPERT
reviewed 3 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.