Edit your virtualhost configuration for that domain, in CentOS it is usually located in /etc/httpd/conf.d/mydomain.conf:
<VirtualHost *:80>
ServerName www.mydomain.com
Redirect / https://www.mydomain.com
</VirtualHost>
<VirtualHost _default_:443>
ServerName www.mydomain.com
DocumentRoot /usr/local/apache2/htdocs
SSLEngine On
...
</VirtualHost>
The most important line is the "Redirect" line which will redirect all http traffic to https.
Once done, save the file.
Do not forget to run syntax test of the configuration files.
# httpd -t
And reload the service
# systemctl reload httpd
No comments:
Post a Comment