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 www.example2.com

    Redirect permanent / http://www.example1.com

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined


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?


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.

  • You have a spacing problem in your directive it should be Redirect Permantent not RedirectPermanent. I assume that is just in your question not on your server, because that would give you a 500 internal server error. – Stephen Ostermiller Aug 19 '17 at 10:01
  • Have you tried just changing it to Redirect Permanent / https://www.example1.com/ with the HTTPS in there? – Stephen Ostermiller Aug 19 '17 at 10:02
  • @StephenOstermiller the redirect works even without the space. I have now added a space and it also works. The reason I am redirecting to http is because the http site redirects to https. Previously I was redirecting to https and it caused the same error with all browsers. Currently on FF causes the problem. – I Newton Aug 24 '17 at 9:50
  • @StephenOstermiller RedirectPermanent is a legit configuration directive, see httpd.apache.org/docs/2.4/mod/mod_alias.html#redirectpermanent – Patrick Mevzek Dec 29 '17 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.