URL works without "www", but not with it

6,662

Solution 1

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.

Solution 2

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.

Solution 3

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:
6,662

Related videos on Youtube

iMaster
Author by

iMaster

Updated on September 17, 2022

Comments

  • iMaster
    iMaster almost 2 years

    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. 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 said) and it fixed it! Yay! Thanks!

    • OMG Ponies
      OMG Ponies over 14 years
      You need to add an A record in your DNS setup. This belongs on serverfault
  • MrGigu
    MrGigu over 14 years
    Yes, he did. An nslookup confirms this.
  • MrGigu
    MrGigu over 14 years
    An nslookup confirms the WWW setup has already been done
  • iMaster
    iMaster over 14 years
    I need to do the opposite of that.
  • thierry
    thierry about 14 years
    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.