- Newest
- Most votes
- Most comments
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:
-
Connect to your Lightsail instance via SSH.
-
Access the root user (if needed) to edit the configuration files.
-
Before making changes, it's recommended to back up your virtual host file.
-
Open the WordPress virtual host configuration file:
sudo vi /opt/bitnami/apache/conf/vhosts/wordpress-vhost.conf
- 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]
-
You should also check the bitnami.conf file at
/opt/bitnami/apache/conf/bitnami/bitnami.conf
and ensure it has the proper redirect configuration. -
After making changes, check the Apache syntax to ensure there are no errors:
sudo /opt/bitnami/apache/bin/apachectl -t
- 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
Relevant content
- asked 2 years ago
- asked a year ago
- AWS OFFICIALUpdated a year ago