Mobile app version of vmapp.org
Login or Join
Bryan171

: Correct way to redirect from HTTP domain to a different HTTPS domain on the same server? Hello I have two different domain names pointing to the same server (same IP in DNS records). One domain

@Bryan171

Posted in: #Apache #Https #Redirects

Hello I have two different domain names pointing to the same server (same IP in DNS records). One domain (example1.com) has SSL enabled and has a fully working website on it. The other domain's (example2.com) only job is to redirect to the one with SSL (example1.com).

I put the following in the sites-available folder for example2.com:

<VirtualHost *:80>

ServerName example2.com
Redirect permanent / www.example1.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>


Note that it is redirecting to example1.com without the HTTPS. This works when testing with Chrome and IE but not with FF. Is this the correct way to do it?

Edit:

I have solved the problem. It was caused by having one SSL certificate for the primary domain but the server has only on IP address. Both domains using the same IP address caused the problem. However we do have a load balance before the server. I set the DNS record for the primary domain to the load balancer IP address and the secondary domain points to the webserver.

Also RedirectPermanent changed to Redirect permanent.

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Bryan171

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme