You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Wilmer Arambula <te...@gmail.com> on 2017/04/20 13:10:37 UTC
[users@httpd] Setup VirtualHost Multiple Domain to SLL Domain.
Hi, I have two domains, domain.web and domain.info, y need redirect to:
https://www.domain.web
http://domain.web ---> https://www.domain.web
http://www.domain.web ---> https://www.domain.web
https://domain.web ----> https://www.domain.web <https://www.domain>
http://domain.info ---> https://www.domain.web
http://www.domain.info ---> https://www.domain.web
https://domain.info ---> https://www.domain.web
https://www.domain.info ---> https://www.domain.web
Before asking I read many posts in stackoverflow, serverfault, and I have
managed to build this configuration that works for me correctly, I would
like to know if this is the best way to do it.
<VirtualHost *:80>
ServerName domain.web
ServerAlias www.domain.web www.domain.info domain.info
DocumentRoot /home/domain/public_html
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^domain\.(info|web) [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain\.(info|web) [NC]
RewriteRule (.*) https://www.domain.web$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerName domain.web
ServerAlias www.domain.web www.domain.info domain.info
DocumentRoot /home/domain/public_html
RewriteEngine On
RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} ^domain\.(info|web) [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain\.(info) [NC]
RewriteRule (.*) https://www.domain.web$1 [R=301,L]
</VirtualHost>
Regards,
--
*Wilmer Arambula. *
Re: [users@httpd] Setup VirtualHost Multiple Domain to SLL Domain.
Posted by js...@sanger.ac.uk.
If you are redirecting all HTTP -> HTTPS you can do:
<VirtualHost *:80>
RewriteEngine on
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=permanent,L,NE]
</VirtualHost>
This will redirect all requests to your https server
{other redirects can be handled on that}
James
--
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org