
: How to redirect a subdomain to the main domain so I can use an SSL certificate? I have an apache server hosting with one IP address hosting a www and a 'sub' domain using <virtualhost>.
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 domain.com/subdir?
More posts by @Shelley277
1 Comments
Sorted by latest first Latest Oldest Best
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 / www.example.com/subdir </VirtualHost>
Once you do that, your SSL certificate can be used on your entire
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.