4
I need my server’s Apache virtualhost to meet the following rule:
1- If it’s.com or www.domain.com, then display the content in /var/www/domain.com/home
2- If for blog.domain.com, then display the content in /var/www/domain.com/blog
3- If it is a wildcard(*), that is, it is not one of the two above, then it displays the content in /var/www/domain.com/platform
For this to be possible I edited my virtualhost as follows:
ServerName dominio.com
ServerAlias www.dominio.com
DocumentRoot /var/www/dominio.com/public_html/home
ServerName dominio.com
ServerAlias blog.dominio.com
DocumentRoot /var/www/dominio.com/public_html/blog
ServerName dominio.com
ServerAlias *.dominio.com
DocumentRoot /var/www/dominio.com/public_html/plataforma
And my DNS zone as follows:
@ IN A 111.111.1.111
(*) CNAME @
Doubt:
The way I did it is a good practice? If not, how would it be? Need to create a record in the DNS zone for the www and to the blog?
I did as you suggested, but why can’t wildcard Servername(*) be the same as the first one? What kind of conflict could occur?
– Gustavo Piucco
You cannot point the exact same server name to different directories...
– Jader A. Wagner