3

I have an apache server hosting with one IP address hosting a www and a 'sub' domain using <virtualhost>. That worked fine until I needed an EV certificate which works on only 1 domain. It can't be used until I merge these two domains. The subdomain is a directory of the www domain.

I can remove the subdomain by removing the appropriate <virtualhost> section. How do I redirect traffic from sub.domain.com to www.domain.com/subdir?

  • One of the best files ever: .htaccess. It's magic ;) – William Edwards Sep 29 '14 at 14:25
1

If you have a virtual host set up, the easiest way to implement the redirect is going to be to replace the virtual host configuration rather than remove it. A virtual host that only redirects has a very simple configuration.

<VirtualHost *:80>
    ServerName sub.example.com
    RedirectPermanent / http://www.example.com/subdir
</VirtualHost>

Once you do that, your SSL certificate can be used on your entire www.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.