Re: Redirection via HTTPS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





2015-02-08 21:15 GMT+01:00 Yann Ylavic <ylavic.dev@xxxxxxxxx>:
On Sun, Feb 8, 2015 at 9:03 PM, Yann Ylavic <ylavic.dev@xxxxxxxxx> wrote:
> On Sun, Feb 8, 2015 at 7:36 AM, YUSUI T <yusui.tomikawa@xxxxxxxxx> 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-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


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         dferradal@xxxxxxxxx

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux