Drupal 8 http not redirecting to https - Solved

Installed letsencrypt no problem
Two websites involved with same sites-enabled content
One forum.ebhc2020.eu drops straight into https
The other ebhc2020.eu does not unless https:// is added. It gives an apache ubuntu default page
I have altered the .htaccess file to include the recommended re-write commands, which were included in the config file

My domain is:ebhc2020.eu

I ran this command: certbot --apache

It produced this output:http and https

My web server is (include version): apache2 latest

The operating system my web server runs on is (include version):ubuntu 18.04

My hosting provider, if applicable, is:Linode

I can login to a root shell on my machine (yes or no, or I don’t know):yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel):no

Hi @Ragodin

create a vHost, which handles port 80

https://httpd.apache.org/docs/2.4/vhosts/examples.html

And there a RewriteCond

https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewriterule

to redirect http -> https.

Will have a go tomorrow, thanks

Well I tried it all creating a non-ssl configuration in sites-available and then using a2ensite then reloading apache but nothing happened apart from apache refusing to restart .
Then removed the lines

RewriteCond %{SERVER_NAME} =ebhc2020.eu [OR]

RewriteCond %{SERVER_NAME} =www.ebhc2020.eu

But leaving

RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI}

Repeated the process and every thing worked
Thanks for pointing me in the right direction

1 Like

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