With the code below I only allow people to visit my website by one domain. I need multidomain support like example.com and example2.com. How to do this?

   ServerName example.com
   ServerAdmin webmaster@example.com
   UseCanonicalName Off
   <If "tolower(%{SERVER_NAME}) != 'example.com'">
      AllowOverride None
      Require all denied

1 Answer 1


You can do this with ServerAlias:

ServerAlias example2.com example3.net

You can also use wildcards:

ServerAlias example2.com *.org *.net

If you want a “catch-all”, use *.* 👍🏻

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.