- Newest
- Most votes
- Most comments
You're trying to update your WordPress site to use https:// instead of http://. Here's how you can do it:
Option 1: Change URL in WordPress Dashboard Log in to WordPress:
Go to http://yourdomain.com/wp-admin and log in. Go to Settings:
On the left side, click Settings > General. Update the URLs:
Look for WordPress Address (URL) and Site Address (URL) fields. Change both URLs from http:// to https://. Save:
Click Save Changes at the bottom. You’ll need to log back in with the new URL. Option 2: Edit the wp-config.php File (if you can’t change it in the Dashboard) Access Your Lightsail Instance:
Go to your Amazon Lightsail console and connect to your WordPress instance via SSH. Edit the wp-config.php File:
In the SSH terminal, type: bash
sudo nano /opt/bitnami/wordpress/wp-config.php
Add these lines at the bottom of the file: php
define('WP_HOME','https://yourdomain.com');
define('WP_SITEURL','https://yourdomain.com');
Replace yourdomain.com with your actual domain. Save and Exit:
Press CTRL + X, then Y, and hit Enter to save. Option 3: Update the Database Directly (for advanced users) Access phpMyAdmin:
Connect via SSH and navigate to http://yourdomain.com/phpmyadmin. Log in:
Use your database username and password. Find the wp_options Table:
Look for the wp_options table, then find siteurl and home. Change the URLs:
Update both to https://yourdomain.com. Important! SSL Certificate: Make sure you have an SSL certificate installed (you can get one for free with Let’s Encrypt) because https:// won’t work without it.
Clear Cache: After making changes, clear your browser cache to avoid issues.
To edit the WordPress and Site URL values, please follow the below instructions ->
-
Sign in to the Lightsail console and navigate to the Instance
Connect
i.e. management page and clickConnect using SSH
button. -
After you're connected to your instance, enter the following command to create a backup of the wp-config.php file. If something goes wrong, you can restore the file using the backup.
sudo cp /opt/bitnami/wordpress/wp-config.php /opt/bitnami/wordpress/wp-config.php.backup
-
Enter the following command to open the wp-config.php file using Vim.
sudo vim /opt/bitnami/wordpress/wp-config.php
-
Use the
Down Arrow
key to keep moving down through the file until you locate one of the below set of lines.define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/'); define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
OR
define('WP_HOME', 'http://your_DOMAIN/'); define('WP_SITEURL', 'http://your_DOMAIN/');
-
Please note, the words will also be part of commented code where they are preceded by a
*
i.e.
* define('WP_HOME','http://example.com');
and
* define('WP_SITEURL','http://example.com');
Those lines are NOT what we are looking for here. The real lines will directly start withdefine
as shown below.
-
All you need to do is replace the
http
on those two lines withhttps
(in above image I have already edited the lines to add thes
). -
To do this use the
Right Arrow
orLeft Arrow
orUp Arrow
orDown Arrow
to bring your cursor on the:
character ofhttp:
. -
Then press
i
to enter insert mode in Vim. -
Then press
s
-
Move down to the next line, bring cursor on the
:
character ofhttp:
and presss
. -
Then press
ESC
button to exit insert mode in Vim. -
Next, press
:wq!
and pressEnter
orReturn
to save your edits to the file and exit Vim completely. -
Now if you login to your WordPress Admin panel and view General Settings, you should see those values as
HTTPS
-
I did notice you've said you tried Option 2 in your response here which provides similar instructions to above, but I believe either the edits did NOT get saved correctly or the lines edited were NOT the right ones perhaps. Please give them another try. After you save your edits, you can try below command to view the file contents and confirm the edits look right.
cat /opt/bitnami/wordpress/wp-config.php
Hello,
Lightsail now provides a guided experience in the Lightsail Console for configuring HTTPS on your WordPress Instance. You can find the guidance, labeled "Option: Guided workflow," here: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-tutorial-launching-and-configuring-wordpress.html#set-up-wordpress-instance-website
Please take a look at the guided workflow to see if it suits your needs, and please reach out if you have further questions.
Thank you, Andy
Admin5WF
- Looking at your website, it already seems to be usinghttps
and accessing with http correctly redirects to the secure https. Did you do something that fixed your issue since your post?Have still not been able to adjust the http:// to https:// in the WP General Settings. The website may be showing as https:// but it is not showing that in the general settings and the plugins which use these settings are refusing us functionality because we are "using http://" according to their read. We also have a site health warning saying we are not using https:// and we should be. The donations provider plugin will not function until we have https://. (Full reply sent separately)
Why is it so difficult to get assistance in this forum?
Is changing http:// to https:// in WP so very difficult as a problem, that nobody helps? Or is it the opposite and newcomers like us asking questions which appear basic are simply not bothered with?
Our charity would really appreciate the help please.
Many thanks.
@AWS-Andy @AWS-SUM @Basel-Mohamed
Hi, Apologies for missing the specifics of your ask earlier. Tried to provide step-by-step instructions here. I really hope it works this time!
Hi @AWS-SUM
Thank you for your much clearer set of instructions. They worked.
We now have https:// in the General settings, which means the donation gallery should now be possible.
I am intrigued by the differing first line command but will look that up later.
May I offer feedback from a new person's perspective. When new to this (WP, Lightsail, and Bitnami) even the very basics and simplest of steps make a difference. For examples, until your last instruction I had no idea to enter "i" to enter edit mode, and I had no idea what "Press :wq! and press Enter" was until I tried "*typing *:wq!" on a blank line and pressing enter. When each step is covered, all becomes much easier to follow.
Thank you again for your time and patience.
I am so glad it worked. And Thank you for your feedback.
But I did want to make sure I understood it correctly, is the suggestion is to replace the word
press
withtype
in the instructions and add more details to make them clearer . or . are you suggesting some Lightsail documentation similar to these instructions would be useful?
Thank you for your guidance.
Unfortunately the issue remains unchanged.
Option 1: unable to do because the fields in question cannot be altered.
Option 2: instructions followed exactly, edits were saved, cache cleared, logged out of WP and then back in ... made no difference ... the WordPress and Site URL addresses in our WordPress General settings remain as http:// and cannot be edited.
Option 3: unable to attempt ... have no idea how to navigate to phpmyadmin, where to find the database username and password, or where to find the wp_options table, let alone do the rest of this solution. FYI - http://5wf.org/phpmyadminonly takes us to a page which says "For security reasons, this URL is only accessible using localhost as the hostname.". We have no idea what to do with that. With respect - "new to WordPress and new to Lightsail" means exactly that, not please write to me as though I am a developer with experience of complex systems and instructions. I have no idea if we even have a database. LOL.
Any other suggestions would be greatly appreciated please.
Many thanks.
Hi and thank you for the recommended reading.
However, unfortunately this does not address the actual question. I am not setting up an instance, I already have one, I already have WP and a site.
I cannot locate the "Option: Guided workflow," you are indicating and I cannot locate in the information you have sent anything which will show me how to change the http:// to https:// in the two fields of WP and Site URL in the WordPress.
Any other suggestions would be welcomed.
This is now urgent for our charity.
Thank you.
Hi there
Our charity would really appreciate some assistance with this please.
Many thanks.
Relevant content
- asked 2 months ago
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 2 months ago
Option 1 is NOT supported in the Bitnami WordPress stack that is available in Lightsail. I am not aware if it is possibly supported in any other WordPress setups.