Web Hosting Talk







View Full Version : How to set up a subdomain properly?


yazansaleh
04-10-2009, 07:14 PM
Hi,

I have a vps server with a company..
and my domain is registered with godaddy.

I would like to create a subdomain: sub.domain.com
I want my subdomain to be in another directroy:

For example:
if the domain.com is: /home/domain.com
then i want the sub.domain.com: to be /home/sub.domain.com

what is the proper way to achieve this? do i need to do something at godaddy? or can I just do everything through my control panel of the vps which is HyperVm.

Thanks in advance

xenex
04-10-2009, 07:54 PM
I think you can do it via HyperVM, if you can, then that way should be fine.

yazansaleh
04-11-2009, 08:38 PM
okay.. i just did it through hyperVM.
But now both the main domain and the new subdomain point to the same directory which is that of the original domain..

When i created the subdomain it asked me for homedirectory and I put something other than the original domain directory.
, yet it still goes to the old one!

how do i solve this?

thanks

yazansaleh
04-12-2009, 11:14 PM
bump.. no help yet!

lordspace
04-12-2009, 11:23 PM
What I do is:

/var/www/vhosts/domain.com/htdocs
/var/www/vhosts/domain.com/logs

If I need a vhost that would be
/var/www/vhosts/sub.domain.com/htdocs


On my other hosting account I have
/com/domain/main/
/com/domain/subdomain/

yazansaleh
04-13-2009, 03:52 AM
On my other hosting account I have
/com/domain/main/
/com/domain/subdomain/

Right now here is what i have on my vps.. via ssh

/home/admin/mydomain
/home/admin/mysubdomain

but whenever i open my subdomain in the web browser it goes to the domain main page. i.e. the files in /home/admin/mydomain
not the ones in /home/admin/mysubdomain

what am i doing wrong?

thanks

mugo
04-18-2009, 06:16 AM
In your httpd.conf, here are the entries:

<VirtualHost *:80>
ServerAdmin root@yourdomain.com
DocumentRoot /var/www/html/domain
ServerName domain.com
ServerAlias www.domain.com
DirectoryIndex index.html
ErrorLog logs/domain.com-error_log
CustomLog logs/comain.com-access_log common

</VirtualHost>

<VirtualHost *:80>
ServerAdmin root@yourdomain.com
DocumentRoot /var/www/html/domain/subfolder
ServerName sub.domain.com
DirectoryIndex index.html
ErrorLog logs/sub.domain.com-error_log
CustomLog logs/sub.comain.com-access_log common

</VirtualHost>

yazansaleh
04-19-2009, 02:41 AM
Thanks a lot mugo
everything works fine after following your steps

mugo
04-19-2009, 02:45 AM
Thanks a lot mugo
everything works fine after following your steps

I'm glad I could help :)

semoweb
04-19-2009, 02:48 AM
Nice Job Mugo You explained it well. Im glad everything is resolved.