Http to httls redirection

Keywords: General - AWS - How to - Secure Connections (SSL/HTTPS)

Dearv team,
I have applied your code for re-direction but many problem is not resolved.

# Redirect non-www to (ssl) www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^nexahair\.com [NC]
RewriteRule ^(.*)$$1 [L,R=301]
# Redirect non-SSL to SSL
RewriteCond %{HTTPS} !on
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

Ideally the redirect should have been 301 -

pls see the above screenshot and help me on this

You need to set the 301 redirection code in both virtual hosts to redirect from http to https and from non-www to www.

Thanks for your reply.
I am very newbie and i dont even know the basic things.
I am using amazon light sail.
Pls support me by step by step instruction.
My domain is
Pls give script hkw and where to add

Pls note during Bncert configuration i have selected :slight_smile:http>>https
which cases 301 redirect.
Even in the apache server i have edited the code but still problem not resolved as that might be SSL issue.
kiindly look into this.

It seems you didn’t apply the changes I mentioned above.

We have a Diagnostic Tool that will gather relevant information for us to analyze your configuration and logs. Could you please execute it on the machine where the stack is running by following the steps described in the guide below?

Please note that you need to paste the code ID that is shown at the end.

Dear jota
to make it safe i tried to made editing in domain
here is the diagnostic tool details.
I am in so much pain because of this as my SSL situation is don’t improving and my rank is getting hurt due to this delay
please help me

what to do now?

Hi @rajatdutt96,

You didn’t update the RewriteRule’s code in the apache/conf/vhosts/wordpress-vhost.conf and apache/conf/vhosts/wordpress-https-vhost.conf. I can still see lines like this one

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

Please ensure you use R=301 in all those RewriteRules and restart Apache after that.

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