Question

Redirecting domain in apache2.conf

This is an odd question - I need to redirect traffic from https to http temporarily. I had a cert on our old, self-hosted server but don’t have one yet on our DO server as I’m still learning my way around the command line and waiting on our CA to issue the cert.

Anyway, visitors to the old site with the cert now go to the new site and are unable to connect because their browser defaults to https thus making the site unreachable. Until I get the updated cert in place, I wanted to redirect all traffic from https to http temporarily and then reverse that once the cert is working.

I tried a couple of tutorials but didn’t find anything definitive and the few changes I did make either did nothing or caused the site to lock up until I removed the offending code.

Can anyone tell me how to do this redirect?

Many thanks in advance.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

In order to setup HTTPS redirect to HTTP, you would need to have an SSL already installed in Apache so that it could listen on port 443.

However if the SSL certificate is not valid there would still be a browser SSL warning. When you open up the website in a browser, it sends a secure handshake request. This comes before the website content / Apache directives / .htaccess redirects come in place.

Practically an attempted connection over https:// will always display a security error if there is no SSL for the domain. It’s a security measure so that connections over SSL will be established only after the validity of the SSLs has been proven on both ends.

Source

What I would recommend instead is installing a Let’s Encrypt certificate while waiting for your actual certificate to be issued. You can follow the steps on how to do that here:

https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-16-04

Hope that this helps! Regards, Bobby