Well there must already be a question very similar to this in stackoverflow.
But before marking as a duplicate, I have an expecification that I did not find any "equal" question that I'm going to do.
Well I intend it is as follows:
I have several domains whose virtualhost point to the same physical path /www/site/public_html
.
However the domain: example.com, I bought ssl and it has https.
What I wanted to do was an htacess file that would make me redirect the http: // and www to https to my example.com domain.
However, I do not want other domains to be affected, that is, I do not want other domains to have https.
In short:
Make 1 condition that if the user comes from http: // example.com or www.example.com automatically redirect to https: // example.com however, if it comes from another domain does nothing.
How could this be possible?
<VirtualHost *:80>
ServerName www.foo.bar
Redirect / https://www.foo.bar/
</VirtualHost>
<VirtualHost *:443>
ServerName www.foo.bar
# ... Configuração SSL
</VirtualHost>
Thank you.