Has anyone tried to setup ssl for a website using only .htaccess file?
I read through many documents which points to apache's httpd.conf file, to add some lines inside <virtual-host>
tag.
But I don't have access to httpd.conf file on my web hosting ...
I can only put . htaccess file in my hosting directory.
So is there a way to achieve HTTPS website using only the .htaccess file.
NOTE: I already have certificates for my domain.
It is possible to install SSL certificates manually on your Web Hosting. You can also learn how to install an SSL certificate automatically. You may also want to read our documentation page on purchasing an SSL certificate for manual installation.
You can redirect from plain HTTP to HTTPS, but you cannot activate SSL/TLS from htaccess.
To activate SSL/TLS, you must use SSLEngine
among other directives
SSLEngine on
As you can see from the documentation,
Context: server config, virtual host
this is only possible in server config or virtual host context, but not in directory and .htaccess context.
This means, you must go through the means your web hosting provider gives you. Probably, activating alone is less expensive or even free of charge, when you already have certificates. Usually, certificates are the expensive part in using HTTPS. Activating SSL in contrast is a one time configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With