Mobile app version of vmapp.org
Login or Join
Shelley277

: 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>.

@Shelley277

Posted in: #Apache #Https #MultipleDomains

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Shelley277

1 Comments

Sorted by latest first Latest Oldest Best

 

@Eichhorn148

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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme