Question

I cannot redirect the subdomain to SSL

I cannot redirect the subdomain to SSL. My domain is izybai.com, it’s good. But when I write the subdomain manager.izybai.com it does not redirect me to SSL, that is, as if I did not have an SSL certificate.

Virtual host archive:

VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName izybai.com
    ServerAlias www.izybai.com
    DocumentRoot /var/www/izybai.com
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName gestor.izybai.com
    ServerAlias www.gestor.izybai.com
    DocumentRoot /var/www/izybai.com/backend
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Please help me!

Thansk!


Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

What I could suggest here is to use certbot to issue a new SSL certificate for your subdomain and then also let certbot add the redirect to HTTPS automatically for you.

If you have certbot already installed, then you can do that with the following command:

sudo certbot --apache -d gestor.izybai.com -d www.gestor.izybai.com

You should see the following output in the end:

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):

If you choose option number 2, then certbot will add the redirect for you.

For more information you can take a look at this tutorial here:

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

Hope that this helps! Regards, Bobby