LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   how to access my website also with "www"? (https://www.linuxquestions.org/questions/linux-server-73/how-to-access-my-website-also-with-www-572418/)

xpucto 07-26-2007 08:53 AM

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.

bathory 07-26-2007 09:01 AM

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

kstan 07-26-2007 09:10 AM

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)

xpucto 07-26-2007 09:19 AM

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?

DotHQ 07-26-2007 09:26 AM

Are you trying to connect locally or from another computer?

Linville79 07-26-2007 09:43 AM

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

kstan 07-26-2007 07:53 PM

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

gani 07-28-2007 01:59 AM

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.

----------


All times are GMT -5. The time now is 03:39 AM.