0

I need to point admin.company.com to 192.168.2.100/admin

How can I do that?

  • 1
    You should tell us the protocol using to access this folder! HTTP, samba share, etc.. – Khaled Feb 12 '11 at 10:03
  • http [... 15 char] – gAMBOOKa Feb 12 '11 at 10:04
5

You cannot do this through etc hosts. You are mixing up 2 different protocols here, http and dns. /etc/hosts will help you redirect admin.company.com to 192.168.2.100, but you need to the redirection to /admin on the web server.

If you are using apache you want to likely used named virtual hosts

...
Port 80
ServerName server.domain.tld

NameVirtualHost 111.22.33.44 

<VirtualHost 111.22.33.44>
DocumentRoot /www/domain
ServerName www.domain.tld
...
</VirtualHost>

<VirtualHost 111.22.33.44>
DocumentRoot /www/subdomain
ServerName www.sub.domain.tld
...
</VirtualHost> 

This article outlines this: http://httpd.apache.org/docs/1.3/vhosts/examples.html

  • Hmm.. how can I do this then? I want admin.local.com pointing to one directory, and a staff.local.com pointing to another? – gAMBOOKa Feb 12 '11 at 10:18
  • added to my entry - thats for apache let me know if you are using IIS on the webserver. Also keep in mind that debian/ubuntu/cent also sometimes use their own configuration files. More information on what your setup is will help advise on how to help – pablo Feb 12 '11 at 12:35

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.