Advertisement
Tritonio

Apache VirtualHost, multiple ServerName in one line

Mar 17th, 2021
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1.  
  2.  
  3. I am using the following tag
  4.  
  5. <VirtualHost *:80 *:443>
  6.  
  7. ServerName blog.mydomain.com
  8. ServerAlias blog
  9.  
  10. to create a virtual host. I've put the ServerName as my subdomain which is blog. However, i'm trying to figure out a way to add www.blog. aswell in the same line rather than having to create a completely new virtual host.
  11.  
  12. Is there a way for this to be done?
  13.  
  14.  
  15. sure, you can add multiple entries to the ServerAlias, see: http://httpd.apache.org/docs/2.2/mod/core.html#serveralias
  16. shareimprove this answer
  17.  
  18.  
  19.  
  20. I tried that before posting, but it didnt work. But I tried: ServerAlias blog www.blog, also tried: ServerAlias blog www that also did not work, then tried ServerAlias blog www.blog.mydomain.com and this worked.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement