# Solved: example.com vs. www.example.com



## techy689 (Jan 9, 2007)

Now I understand example.com vs. www.example.com are two totally different things, but that is not the case for me with my domain being hosted by GoDaddy. They have the exact same content, etc.

However, to Google and other Web Crawlers, example.com and www.example.com are two different things, and search results show this as well.

How can I make it so that my domain is only www.example.com, and NOT example.com?

I tried using some code in a .htaccess file, however, ended up having an internal server error.

Thanks.


----------



## namenotfound (Apr 30, 2005)

s4baz said:


> Now I understand example.com vs. www.example.com are two totally different things.


What are you talking about? They both have the same content



> You have reached this web page by typing "example.com", "example.net", or "example.org" into your web browser.
> 
> These domain names are reserved for use in documentation and are not available for registration. See RFC 2606, Section 3.


What do you mean by "totally different"?



s4baz said:


> They have the exact same content, etc.


They're supposed to. I still don't understand what you're asking.



s4baz said:


> How can I make it so that my domain is only www.example.com, and NOT example.com?


If you did that, you might annoy some people that type in example.com hoping to get your site only to find out they can't because they didn't type "www." first.

***********

If you REALLY want to do what you're asking, then it must be done in the DNS settings. Right now the DNS is set up to allow access when "www." is added, and when it isn't. Do you have access to the DNS settings on GoDaddy?


----------



## madd74 (Nov 9, 2003)

well, if you do not use subdomains, you could use the following code that would redirect:

RewriteCond %{HTTP_HOST} !^example.com$ [NC]
RewriteRule ^.*$ http://example.com/$1 [R=301,L]

this would go in your .htaccess file

Otherwise, I agree with 404 when he states is not not sure what you mean by "totally different".
Do you have PRINT SCREEN shots that by chance show this difference that you speak of?


----------



## MMJ (Oct 15, 2006)

namenotfound said:


> If you did that, you might annoy some people that type in example.com hoping to get your site only to find out they can't because they didn't type "www." first.


I think what he wants is that if he types in his domain without www he gets redirected to the same domain but with www. My domain does that even though I never added code for it.


----------



## namenotfound (Apr 30, 2005)

MMJ said:


> I think what he wants is that if he types in his domain without www he gets redirected to the same domain but with www. My domain does that even though I never added code for it.


Well he should have explained himself better if that's what he wasn't.

It _is_ possible to block off access to anyone that doesn't type "www." and I assumed that's what he was asking.

Yes, you can simply redirect example.com to www.example.com, which would be the better ways to go. But the way he was asking, I thought he wanted to deny access.


----------



## techy689 (Jan 9, 2007)

I just added this to my .htaccess:

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

Thanks.


----------

