• Aksel Lian
  • -
  • No tags

Promlem:

You have added a domain and all seems well, but suddenly you realise the redirection for https doesn’t work.

You are certain your .htaccess redirection code is correct, but the non-https version of your domain url sends you to wrong page.

 

Here is a good code for https redirection for both www and non-www

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]

#Now, rewrite to HTTPS:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example-com/$1 [L,R=301]

 

Vesta domain ssl fix

The easiest way to fix this issue is to create a new user and link it to a domain.

You want to move your domain data to a user with the correct ssl files, so the permissions are fixed to correct values.

Many have issues with https redirect still not working after domain move, so a good solution is to bounce the domain to a ssl working user and then over to the new user if that is what you want.

 

Step 1

v-change-domain-owner mydomain.com myusername

if you get any error with this code, move the domain with the above code to another user and then back to the user you want,

Test out your domain for redirections on https://www.whynopadlock.com/

Alternatively use a testing tool with no cache or cookies or use one of your webbrowsers and do remember after a successfull https connection, it stays active, giving misleading assurance that all is working well. Solution is to close browser fully, then reopen.Vestacp: https redirection fix and solutions

 

Vestacp: https redirection fix and solutions juli 12th, 2018 Aksel Lian

En selvstendig webutvikler med en bred variasjon av kunnskaper herunder SEO, CMS, Webfotografi, Webutvikling inkl. kodespråk..