Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
Domain without the 'www.' gives me the Apache 'It works!' page

Hey, I've seen this quesiton asked the opposite way, but I'm having the problem stated above. My website: http://getfitcore4.com works like that, but as soon as you add "www" it doesn't work. I'm hosting it with Network Solutions. Is there a way to fix this?

EDIT: It appears that I have done the obvious things correctly based on Farseeker's comments.

"Can you update your question with the part of your apache configuration with your host is set up?" Not sure what you're asking for here... How would I go about finding this?

Thanks for your help guys. I also tried this:

RewriteEngine on
RewriteCond %{HTTP_HOST} !^getfitcore4\.com$ [NC]
RewriteRule ^(.*)$ http://getfitcore4.com/$1 [R=301,L]

But that didn't work either. Even if there's a solution that's just a quick fix, such as a re-write, that's fine for now. I really need to get this working, though.

Guess who feels like an idiot? ME! All I had to do was set up a www. sub-domain (like some of you guys said) and it fixed it! Yay! Thanks guys!!

share|improve this question

migrated from stackoverflow.com Jan 5 '10 at 1:52

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Mark Henderson Sep 9 '11 at 5:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
You need to add an A record in your DNS setup. This belongs on serverfault –  OMG Ponies Jan 5 '10 at 1:49
add comment

7 Answers 7

up vote 4 down vote accepted

Make sure you have:

  1. A CNAME record in your DNS settings so that www.getfitcore4.com (CNAME) points to getfitcore4.com (A).

  2. A web server set up to handle requests at www.getfitcore4.com, not just getfitcore4.com.

share|improve this answer
    
Can you elaborate on your second point? I understand the first step, but am a bit confused about what specifically you mean by the second. –  Jonathan Sampson Jun 4 '10 at 17:46
add comment

His DNS is fine. His virtual server configuration is broken. Configure your web server to respect www.getfitcore4.com as an alternate domain, or to send HTTP redirects to send people to the www-less version.

share|improve this answer
add comment

You need to setup a record so that the www subdomain points to your IP address with an A record, I believe. Correct me if I'm wrong.

If you have access to modify Vhosts, configure them something like so:

<VirtualHost *:80>
ServerName sitename.com
RedirectMatch permanent ^/(.*) http://www.sitename.com/$1
</VirtualHost>

<VirtualHost *:80>
ServerName www.sitename.com
DocumentRoot /var/www/html/site
</VirtualHost>
share|improve this answer
    
An nslookup confirms the WWW setup has already been done –  Mark Henderson Jan 5 '10 at 1:57
add comment

Did you set up the proper DNS settings, since www is essentially a subdomain.

share|improve this answer
    
Yes, he did. An nslookup confirms this. –  Mark Henderson Jan 5 '10 at 1:57
add comment

Another way to do it without relying on DNS is described here: http://www.thesitewizard.com/apache/redirect-domain-www-subdomain.shtml

Since you tagged this "apache", I think this will work for you. It's also a good way to learn about url-rewriting.

share|improve this answer
    
I need to do the opposite of that. –  iMaster Jan 5 '10 at 2:28
add comment

According to NSLookup, your DNS is configured correctly, which is great.

Seeing as your question is tagged "Apache", I'm going to assume that this is your web server of choice, thus the problem will be in the bindings of your Apache site.

Can you update your question with the part of your apache configuration with your host is set up?

share|improve this answer
add comment

I had this problem too, and found my solution here.

Basically, after an upgrade, Apache put a symlink in /etc/apache2/sites-available. Deleting everything between and including <VirtualHost *:80> and <VirtualHost> got everything working for me again.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.