I have a domain domain.org

I am adding SSL, unforunately a lot of subdomain where created as "www.subdomain" and it is way more expensive to create certificate to multiple 3 level subdomains.

Is it possible to redirect www.subdomain.domain.org to subdomain.domain.org without redirecting for www.domain.org?

1 Answer 1


Yes, check out the Apache 2.2 doc for mod_rewrite:

Apache Module mod_rewrite

Also check this serverfault post: Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About Mod_Rewrite Rules but Were Afraid to Ask

But remember. SSL is negotiated before URL rewriting, so you will get a CN mismatch error on your browsers.

You can consider buying an SSL wildcard certificate, which covers all subdomains whitin a domain. But this certificates are more expensive than traditional certs.


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.