Redict from www.mysite.dk to https://www.mysite.dk

Silverstripe Version: 4.2

Question: How to Redict from www.mysite.dk to https://www.mysite.dk

_Hello

I uploaded a site in ss 4.2 today and the site works fine and runs https. It also works fine on localhost.

But if I go to www.mysite.dk (danish) it gets redirected to https://www.mysite.dk/public/ and then it seems like it can’t find the template for the page. The navbar and sidebar is showing fine, but the “inner template” is not found.

It’s a shared host (one.com) and on their site they recommended to have:

RewriteCond %{HTTPS} !=on

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

in .htaccess.

So I placed that under RewriteBase ‘/public’ in the .htaccess in /public .

How can I get redirect from www.mysite.dk to https://www.mysite.dk without this problem?

Any suggestions?

Kim_

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

In the root .htaccess:

RewriteEngine On

# one.com ONLINE
# De to linier herunder er fra One.com - force to https
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# one.com end
# online end

# from ss
RewriteRule ^(.*)$ public/$1

In the public/.htaccess:

# From SS
    RewriteBase '/public'

…and in .env:

SS_BASE_URL="https://www.mysite.dk/"