HTTP not redirecting to HTTPS >> rewrite module enabled

My domain is: http://clsindustriesllc.com

I ran this command: sudo a2enmod rewrite; sudo service apache2 restart

It produced this output: Module rewrite already enabled
… yet, http still does not auto redirect to https

My hosting provider is: Digital Ocean

I can login to a root shell on my machine: Yes

So yes, when you access my site from http://, it does not auto redirect.
Please assist!! :pray:

1 Like

Hi @Ghost0

checking your domain - https://check-your-website.server-daten.de/?q=clsindustriesllc.com

There is no redirect http -> https.

But there is an older check, created 2019-10-15. There is the correct redirect.

Looks like you have removed the redirect rule. Or you have changed your configuration, so now the wrong vHost is used.

Read the comments of the new check and add such a rule.

1 Like

Enabling the module merely expands the coding vocabulary to include “rewrite” type actions.

Now you need to include some code to tell anyone that connects to the http block to redirect to https.

For Apache, it would be something like:

RewriteEngine On
RewriteRule ^\.well-known\/acme-challenge\/ - [L]
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

or even as simple as:

RedirectMatch ^/(.*)$ https://%{HTTP_HOST}/$1
2 Likes

Thank you both for the supports. I must admit, my coding and command line knowledge is a bit limited.

Would someone be able to assist me further?

(Yes, I could use some hand holding) >.<

1 Like

It should be a very simple change.
Please show your vhost config for port 80.
[most likely a file located in the sites-enabled folder]

1 Like

… I still don’t exactly follow…

So I need to type something in my command line?

(Yes, this is how limited my knowledge is…)

1 Like

Who manages the website?
Who put it all together?

Before you enforce TLS, the site should be readied - it’s not ready for that:
https://www.whynopadlock.com/results/37eff543-b1ac-4591-8a8c-33b7727b1873

1 Like

I am the one who set it all up.

I just used Digital Ocean’s easy droplet creation app to install Wordpress.
I created my site.

However, again, my knowledge and understand isn’t up to par with your guys unfortunately.

Would you be able to assist me in a less tech savvy way??
Please.

I am just a general consumer with basic knowledge.

1 Like

That is not the purpose of this forum but I will try to assist.

Do you have access to the command line (ssh terminal/console)?

1 Like

I can understand that.

And yes, I do have access to the command line

OK type the following and reply with the output:
ls -l /etc/apache2/sites-enabled/

OK that’s perfect.
Two files:

  • one for HTTPS
  • one for HTTP

We will be modifying the one for HTTP (to insert the code to redirect everyone to HTTPS).
Please reply with output of:
cat /etc/apache2/sites-enabled/000-default.conf

1 Like

12

It seems there is already code there to redirect…

Please show:
grep -Eri '80|clsindustries|include|virtual|servername|serveralias' /etc/apache2

Nothing new returned.

ls -l /etc/apache2/

Your text shows “>” where mines was “|”

1 Like

52

1 Like

copy and paste this command (don’t try to type it):

grep -Eri '80|clsindustries|include|virtual|servername|serveralias|listen' /etc/apache2
2 Likes

@rg305 is looking for you to run the grep command again, but using the correct | rather than the incorrect > character in between the various words in the search pattern.

2 Likes