LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Hostnames and subdomain (https://www.linuxquestions.org/questions/linux-server-73/hostnames-and-subdomain-4175484435/)

netpumber 11-13-2013 07:50 AM

Hostnames and subdomain
 
Hello out there.

Here is the story:

I have bought a domain name. e.g test.org from godaddy.

I have create a hostname www.test.org in my godaddy account to connect the domain name with my web server's IP.

When you visit www.test.org browser reads files from /var/www

Now i have created a new dir in /var/www called news (/var/www/news/) and i want to create a subdomain news.test.org and when you type it on the browser to read files from /var/www/news without the URL be changed like www.test.org/news. I want the url stay as news.test.org

Is something like that possible ?

Thank you.

TenTenths 11-13-2013 08:03 AM

Yes, create an entry at Godaddy that points news.test.org to your web server.
On your server configure apache to use NameBased virtual hosting and configure a virtual host to use /var/www/news as the document root.

However, if you have your main host set to use /var/www as the document root then www.test.org/news will (by default) also show the content from the /var/www/news folder.

netpumber 11-13-2013 10:11 AM

Godaddy has two options. Either to create a subdomain that redirects to a specific url or you can add another one host except of the www.
What entry to create so ? Can you be more specific because im a little new on these ideas.
Thank you!

TenTenths 11-13-2013 10:21 AM

Oh, sorry, my mistake, I had (wrongly) assumed you had control over your own webserver rather than using a GD hosting account.

What does GD support / docs say to do?

netpumber 11-13-2013 04:22 PM

Hmmm there is a confusion :p . The web server is mine (at home with static IP). The domain is at GD. So for www.test.org i have create a hostname in GD account and connect it with the static IP of my server. The problem is that if i create a subdomain (news.test.org) to redirect to the /var/www/news , the url when you write new.test.org and press enter it becomes www.test.org/news and it doesn't stay news.test.org. The question is if its possible, after pressing enter the url to stay as it is (news.test.org).

TenTenths 11-13-2013 05:05 PM

Hostnames and subdomain
 
yes, see my first reply. ignore godaddy redirection create an A record for news. test.org pointing to the same IP as your Web server and use namebased virtual hosts to serve the content.


All times are GMT -5. The time now is 10:32 PM.