Redirecting non-www to www and HTTPS

Keywords: WordPress - AWS - Technical issue - Secure Connections (SSL/HTTPS)
bnsupport ID: 075e21ba-3907-40a9-3278-8ab2c446d849
Description:
I set my redirection in bitnami.conf it redirected non-www to www but not directing to https. Only my home page works on both redirect but my sub pages not redirecting. Please advise.

Hi @darylaurito93

Thanks for using Bitnami WordPress!

Have already solved the issue? I tried to access your site and was correctly redirected to its HTTPs:

$ curl -LI --silent www.XXXXshpro.com
Location: https://www.XXXXshpro.com/

HTTP/2 200
date: Thu, 10 Jun 2021 08:29:07 GMT
content-type: text/html; charset=UTF-8

Best regards,
Jose Antonio Carmona


Was my answer helpful? Click on :heart:

Hi @jcarmona,

The home page redirects but the subpages never redirect. eg.http://www.XXXXshpro.com/design-agency/

Please advise.

Hi again!

I have been reviewing your configuration and found some possible reasons for this to be happening. Let’s try to fix that!

Add the following lines to your /opt/bitnami/apps/wordpress/conf/httpd-vhosts.conf file:

<VirtualHost *:80>
    ServerName XXXXXshpro.com
    ServerAlias www.XXXXshpro.com
    DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"

+   RewriteEngine On
+   RewriteCond %{HTTPS} !=on
+   RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
+   RewriteRule ^/(.*) https://www.XXXXshpro.com/$1 [R,L]

    Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>

...

Remember to substitute www.XXXXshpro.com with your actual domain www.DOMAIN.com. After that, restart your Apache service and see if the redirection happens now:

$ sudo /opt/bitnami/ctlscript.sh restart apache

Best regards,
Jose Antonio Carmona


Was my answer helpful? Click on :heart:

1 Like

@jcarmona thanks for the reply. How about my bitnami.conf file?

Thanks for the community answer, It will be helpful to me.

As you are using VirtualHosts to server your WordPress site, there’s no need to modify the binami.conf file :slightly_smiling_face:

Glad to see you were able to solve your issue! We are marking this topic as “Closed”.

If you have any other questions, please do not hesitate to let us know. Feel free to create a new topic referencing this one if necessary.

Best regards,
Jose Antonio Carmona


Was my answer helpful? Click on :heart: