0

I have Debian virtual server on some sub-domain (for example subdomain.domain.com) and i have alias for this sub-domain (for example alias.domain.com), of course when I use both of this sub-domains (for example ping them, or log in with putty/winscp) DNS server returns same IP address. (I hope terminology is clear, I'm not familiar with networking) However I have two web pages, and what I want is this:

when you write one sub-domain (subdomain.domain.com) in your web browser to open one page. when you write alias (alias.subdomain.com) in your browser to open other page.

Is this possible ? And if it is, can you explain me how to do it ? (I was thinking about making two public_html folders - one for sub-domain, one for alias, but have no idea how to make it work.) Once again I apologize for bad terminology.

1 Answer 1

1

This is perfectly possible using VirtualHosts in Apache.

An common example of a VirtualHost config can be as

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName subdomain.domain.com
    DocumentRoot /var/www/website1
</VirtualHost>

<VirtualHost *:80>
    ServerName alias.domain.com
    DocumentRoot /var/www/website2
</VirtualHost>

In this case one domain is served from one folder, while the other is served from another folder.

You need to enable NameVirtualHost in Apache. A great help can be the Apache helps which can be found on http://httpd.apache.org/docs/2.2/vhosts/

Beware that SSL for example might be tricky when using VirtualHosts.

Please let me know if you have any other questions.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .