LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 07-26-2007, 09:53 AM   #1
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Rep: Reputation: 31
how to access my website also with "www"?


Hi!
On my apache2 I have a few websites. Everything works fine except that the websites can only be reached without "www". for examle: http://mywebsite.com works, but www.mywebsite.com doesn't. Is it due to the configuration in http.conf or due to the DNS configuration?

thank you.
 
Old 07-26-2007, 10:01 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,962

Rep: Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341Reputation: 1341
It could due to anyone or both. Try to resolve www.mywebsite.com and if you cannot then it's your dns. If you can then it's httpd.conf
 
Old 07-26-2007, 10:10 AM   #3
kstan
Member
 
Registered: Sep 2004
Location: Malaysia, Johor
Distribution: Dual boot MacOS X/Ubuntu 9.10
Posts: 851

Rep: Reputation: 31
try to add following line in your /etc/hosts file

xxx.xxx.xxx.xxx(your webserver ip) www.mywebsite.com

If you website display correctly mean you need to update your dns data (Add www into database)
 
Old 07-26-2007, 10:19 AM   #4
xpucto
Member
 
Registered: Sep 2005
Location: Vienna, Austria
Distribution: Mint 13
Posts: 522

Original Poster
Rep: Reputation: 31
thanks for the answers.

Quote:
Originally Posted by kstan
try to add following line in your /etc/hosts file

xxx.xxx.xxx.xxx(your webserver ip) www.mywebsite.com

If you website display correctly mean you need to update your dns data (Add www into database)
I did this and didn't help. what does that mean then?
 
Old 07-26-2007, 10:26 AM   #5
DotHQ
Member
 
Registered: Mar 2006
Location: Ohio, USA
Distribution: Red Hat, Fedora, Knoppix,
Posts: 542

Rep: Reputation: 33
Are you trying to connect locally or from another computer?
 
Old 07-26-2007, 10:43 AM   #6
Linville79
Member
 
Registered: Nov 2006
Location: Indiana, U.S.A.
Distribution: Red Hat Enterprise Linux, Fedora, CentOS
Posts: 134

Rep: Reputation: 16
Are you trying to access that website from a computer outside of your LAN?

If so, you'll need to have the domain name that you are trying to use registered with a domain registrar.

Then you will need to ensure that you have a www line in your DNS for that domain that points to that server's IP address.

Example:
mywebsite.com. 1H IN A ###.###.###.###
www.mywebsite.com. 1H IN A ###.###.###.###

Then you will need to ensure that your httpd.conf or virtual host file is configured to "listen" for the www as part of the URL.

Example:
ServerName mywebsite.com
ServerAlias www.mywebsite.com
 
Old 07-26-2007, 08:53 PM   #7
kstan
Member
 
Registered: Sep 2004
Location: Malaysia, Johor
Distribution: Dual boot MacOS X/Ubuntu 9.10
Posts: 851

Rep: Reputation: 31
If you add record inside /etc/hosts file result still the same, I believe the problem come from your httpd.conf. Try to check the virtual host section, change or add virtual www.mywebsite.com
 
Old 07-28-2007, 02:59 AM   #8
gani
Member
 
Registered: Jun 2004
Location: Metro Manila, Philippines
Distribution: OpenBSD, Slackware, XP
Posts: 347

Rep: Reputation: 31
In your domain's DNS zone file, add CNAME(s):

Code:
; Aliases
www               IN CNAME     mywebsite.com.
If your DNS is hosted outside, request your host to do it for you and its free.

This principle as well would apply if you want to have SMTP and POP3 hosts and as example.

Code:
; Aliases
www               IN CNAME     mywebsite.com.
smtp              IN CNAME     mywebsite.com.
pop3              IN CNAME     mywebsite.com.
So accessing both mywebsite.com and www.website.com would point to your website's IP.

----------
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
using symlinks for /home/"username" and /var/www/html hamza11050 Linux - Networking 10 08-05-2005 11:36 PM
Where is the Embedded Linux "HOWTO" at http://www.tldp.org ? t3gah General 14 06-06-2005 07:35 AM
Take all posts from "Website Suggestions & Feedback" out of the "0 Reply Thread&q t3gah LQ Suggestions & Feedback 7 03-21-2005 08:27 PM
"X-MS" cant open because "x-Multimedia System" cant access files at "smb&qu ponchy5 Linux - Networking 0 03-30-2004 12:18 AM
need help, on how to access quickly to special characters like "" or ""? Motaro Linux - Newbie 1 12-31-2003 12:53 PM


All times are GMT -5. The time now is 07:46 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration