LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-08-2012, 10:12 AM   #1
societymedia
LQ Newbie
 
Registered: Dec 2012
Posts: 8

Rep: Reputation: Disabled
Apache VirtualHost works for www.domain.com but not for domain.com


Hi everyone. First post and second day exploring Linux. I have followed a few tutorials and managed to get my domain working for www.domain.com but not domain.com (or vise versa).. just NOT both at the same time...

I have a few domains i want to host using one box(one IP) so VirtualHost is what i am assume i needed.

all i did was in my httpd.conf file:
NameVirtualHost *:80

and add a few

<VirtualHost> elements. Would i need one <virtualHost> per :
www.domain.com and another <virtualHost> for domain.com ?

Thanks so much!
 
Old 12-08-2012, 10:55 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

You should use:
Code:
<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com
...
</VirtualHost>
Cheers
 
Old 12-08-2012, 11:06 AM   #3
societymedia
LQ Newbie
 
Registered: Dec 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
Awesome thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache no-www to www domain rewrite after upgrade deesto Linux - Server 5 06-20-2012 12:16 PM
site only works with www. in front of domain name B-Rye Linux - Server 6 04-17-2012 11:44 AM
Bind9 all *.domain.com reachable, only www.domain.com isn't TonyDeWittePony Linux - Server 1 07-14-2011 01:03 PM
setting up domain thru virtualhost on apache fiona333 Linux - Newbie 2 06-20-2007 05:27 PM
DNS http:domain.com resolve to www.domain.com keysorsoze Linux - Networking 3 02-12-2007 03:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration