git.net

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

Re: [users@httpd] Configuring redirects from http to https


I quickly discovered that when a test of host2 returned the host1 index page. So I changed the second VirtualHost address to be the same as host1 (aaa.bbb.ccc.ddd:80). That seems to have solved the problem. So now the actually working  *.conf is as follows (as a template?):

Listen 80
# Listen 443 not included since it was already listening

# http redirect
<VirtualHost aaa.bbb.ccc.ddd:80>
 ServerName www.host1.com
 ServerAlias host1.com *.host1.com
 Redirect / https://www.host1.com/
 ErrorLog /var/log/apache2/host1.com-error80_log
 CustomLog /var/log/apache2/hos1.com-access80_log combined
</VirtualHost>

<Virtualhost aaa.bbb.ccc.ddd:80>
 ServerName www.host2.com
 ServerAlias host2.com *.host2.com
 Redirect / https://www.host2.com/
 ErrorLog /var/log/apache2/host2.com-error80_log
 CustomLog /var/log/apache2/host2.com-access80_log combined
</VirtualHost>

# https version
<VirtualHost aaa.bbb.ccc.ddd:443>

 ServerAdmin webmaster@xxxxxxxxx
 ServerName www.host1.com
 ServerAlias host1.com *.host1.com
 DocumentRoot "/<wherever your root is>"
 SSLEngine on
 SSLProtocol all -SSLv2
 SSLCertificateFile /etc/apache2/ssl.crt/<certificate>.crt
 SSLCertificateKeyFile /etc/apache2/ssl.key/<key>.key
 SSLCertificateChainFile /etc/apache2/ssl.crt/<chain file>.txt
 RewriteEngine On
 RewriteOptions Inherit

et cetera



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx