Page 1 of 1

apache forward https request to http

Posted: Thu May 08, 2025 7:39 am
by mister_v
hi,

I (still) have a website with no ssl certificate, so only http.
As most browser now automatically forward to https when typing just the url,
It is a problem.
As I host several site son the same server (same ip, port)
it automatically does to the main site. Not the site intended with the url name.

How do I fix this ?

Re: apache forward https request to http

Posted: Thu May 08, 2025 8:23 am
by chris
Simplest way edit the site conf file in
nano /etc/apache2/sites-available/000-example.com.conf

and add or update:

Code: Select all

<VirtualHost *:443>
        ServerName www.example.com
        redirect permanent / http://www.example.com/
</VirtualHost>
This will redirect and https://www.example.com to http://www.example.com

Don't forget to restart apache.

Code: Select all

etc/init.d/apache2 restart