homepage Welcome to WebmasterWorld Guest from 54.227.160.102
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / WebmasterWorld / Domain Names
Forum Library, Charter, Moderators: buckworks & webwork

Domain Names Forum

    
changing mydomain.com to www.mydomain.com
how does one change from one to the other
timciccone

10+ Year Member



 
Msg#: 909 posted 1:47 pm on Jan 3, 2003 (gmt 0)

Hi,

Sorry for asking such a simple question, but I am new to this post. Can one use .htaccess to change mydomain.com to www.mydomain.com? I found some examples using RewriteEngine, but I was unable to make it work. Can anyone help? Thank you.

 

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 909 posted 5:33 pm on Jan 3, 2003 (gmt 0)

timciccone,

Welcome to WebmasterWorld [webmasterworld.com]!

You might want to check out this Introduction to mod_rewrite [webmasterworld.com] - it will walk you through the process of using mod_rewrite in .htaccess files, including how to test to see if it is available on your server. mod_rewrite is a very powerful tool, and dangerous as a result; I highly recommend you research it before risking a server outage.

Also, you must set up your "Zone file" to indicate that both domain.com and www.domain.com represent the same "account". Contact your host to find out how to do this if it's not already done.

The code to redirect is quite simple, assuming everything else is in order...
in .htaccess:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=permanent,L]

HTH,
Jim

wangdy

10+ Year Member



 
Msg#: 909 posted 3:51 pm on Jan 8, 2003 (gmt 0)

Hi,

Hopefully you'll be able to clarify.... I was not sure what the difference was between www.domain.com and domain.com. From your post... does that mean a mod_rewrite is needed on my web server to direct people to the same URL? I always thought that both were the same thing...

Thanks for educating me!

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 909 posted 6:32 pm on Jan 8, 2003 (gmt 0)

wangdy,

www.domain.com is a subdomain of domain.com, just as home.domain.com is.

You do not have to redirect in order to process the user-agent's request - In almost all cases, a request for www.domain.com and for domain.com will return the same content - unless you have set it up otherwise.

The advantage of doing a redirect is to "concentrate" link popularity and "branding" into one domain or the other - you choose.

For example, if you decide to use "domain.com" as your "official" web address, then you would redirect any requests for www.domain.com to domain.com using a 301 redirect. Anyone who typed in "www.domain.com" would see the URL in his address bar "magically" change from [domain.com...] to [domain.com....] This would help prevent other webmasters from linking to your "unofficial" address, and would help to fix "domain.com" in the minds of your visitors for branding purposes.

Advanced robots like Googlebot can figure out when www.domain.com is the same site as domain.com, but there may be others that can't - and so you might end up with two listings on page 3 of the search results instead of one listing on page one.

Hope that clarifies things a little.

Jim
<edit>typos</edit>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Domain Names
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved