Change wordpress/site URL to HTTPS:

Hi I added a SSL certificate to my AWS instance and changed DNS. Everything works great, but I how do I change my site and wordpress URL to https:? I use terminal just need the commands from the beginning starting with sudo etc. please. Thanks

Hello i need this solution, because i have a same problem… On my blog and is really urgnet

Hi @markj2324 and @antivirusandroid,

You can find information on how to force https redirection in the following section of our manual:

https://docs.bitnami.com/general/apps/wordpress/#how-to-force-https-redirection

Please let me know if you encounter any difficulties.

Regards,
Michiel


Please, click on :heart: if you think my answer was helpful

Hi @michiel The page is not redirecting correctly. I tried to do it with AWS support, but the file /opt/bitnami/apps/wordpress/conf/httpd-prefix.conf is redirecting indefinetely. What should we try next?

Thanks,

Mark

Hi @markj2324,

We have a Support Tool that will gather relevant information for us to debug the issue. Could you please download and execute it on the machine where the stack is running by following the steps described in the guide below? You must click on the platform or cloud that you are using to find the correct instructions.

How to Run the Bitnami Support Tool

Please note that you need to paste the code outputted by the tool in your reply.

Regards,
Michiel D’Hont

Hi @markj2324,

The redirection rules as described in the guide are commented out, did you do this to prevent the page from redirecting indefinitely?

Regards,

Michiel D’Hont

@michiel I have been trying to figure it out for a couple of weeks now with AWS support. I just want to change the site url to https: permanently. What should I do? Can’t start company until changed. Thanks Mark

@michiel from AWS support:

Hello Mark,

Bitnami support must be talking about the following lines we commented out in the file /opt/bitnami/apps/wordpress/conf/httpd-prefix.conf:

RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]

These lines were provided by them but did not work for you and were redirecting indefinitely. You can mention this to them. You can also tell them that since those lines did not work, we edited the file /opt/bitnami/apache2/conf/bitnami/bitnami.conf and added the following lines which worked for my test site, www.prabhala.org:

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]

Hi @markj2324,

Did the solution proposed by AWS solve the issue?

Regards,

Michiel

@michiel No it didn’t, and they said it was out of there scope to figure it out. I finally figured it out myself. Thank you

  1. Login to bitnami through terminal

  2. Login to wp-config folder Run command sudo nano /opt/bitnami/apps/wordpress/htdocs/wp-config.php

  3. REPLACE THIS:

define(‘WP_SITEURL’, ‘http://’ . $_SERVER[‘HTTP_HOST’] . ‘/’);
define(‘WP_HOME’, ‘http://’ . $_SERVER[‘HTTP_HOST’] . ‘/’);

WITH THIS:

define(‘WP_HOME’,‘https://www.yourdomain.com’);
define(‘WP_SITEURL’,‘https://www.yourdomain.com’);

Remember to replace yourdomain with either the www. or non-www. version of your domain name - whichever your prefer.

  1. After adding this code, press CTRL+o to save changes, followed by CTRL+x to exit back to your home screen.

  2. Restart Apache sudo /opt/bitnami/ctlscript.sh restart apache

Permanently change to HTTPS from HTTP for site URL and wp home on dashboard.

I didn’t see this anywhere would be a good document write up. Hope this helps

3 Likes

Hi @markj2324,

Thanks a lot for sharing your solution here.

Regards

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.