2015-02-08 21:15 GMT+01:00 Yann Ylavic <ylavic....@gmail.com>: > On Sun, Feb 8, 2015 at 9:03 PM, Yann Ylavic <ylavic....@gmail.com> wrote: > > On Sun, Feb 8, 2015 at 7:36 AM, YUSUI T <yusui.tomik...@gmail.com> > wrote: > >> > >> root@hostname:~# tail -n 6 /etc/apache2/mods-available/ssl.conf > >> <VirtualHost *:443> > >> ServerName www.mydomain.com > >> Redirect / https://www.mydomain.com/ > >> </VirtualHost> > > > > You probably want to redirect to https when the request is plain http, > hence : > > <VirtualHost *:80> > > above. > > Sorry, I completely misread your issue, please ignore this. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org > For additional commands, e-mail: users-h...@httpd.apache.org > > This is the list of virtualhosts you need. It could be reduced, but for educational purposes here is how all virtualhosts should look to represent your scenario more or less as I have understood you were asking. As you will see there is no need for mod_rewrite at all for this case.
I assumed you want to redirect port 80 to SSL too, if not, ignore the first non-ssl virtualhost examples. ### # domain.com port 80 redirects to SSL www.domain.com <VirtualHost *:80> ServerName domain.com DocumentRoot /path/to/docroot Redirect / https://www.domain.com/ </VirtualHost> ### # www.domain.com port 80 redirects to SSL www.domain.com <VirtualHost *:80> ServerName www.domain.com DocumentRoot /path/to/docroot Redirect / https://www.domain.com/ </VirtualHost> ### # domain.com port 443 SSL redirects to SSL www.domain.com <VirtualHost *:443> ServerName domain.com DocumentRoot /path/to/docroot SSLEngine on SSLCertificateKeyFile /my/path/to/domain.com.key SSLCertficicateFile /my/path/do/domain.com.crt Redirect / https://www.domain.com/ </VirtualHost> #### # www.domain.com port 443 SSL <VirtualHost *:443> ServerName www.domain.com DocumentRoot /path/to/docroot SSLEngine on SSLCertificateKeyFile /my/path/to/www.domain.com.key SSLCertificateFile /my/path/do/www.domain.com.crt ### # And your actual configuration from here on </VirtualHost> Hope this helps -- *Daniel Ferradal* IT Specialist email dferra...@gmail.com linkedin es.linkedin.com/in/danielferradal