1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to add www?

Discussion in 'White Hat SEO' started by Dark Knight, Jan 22, 2010.

  1. Dark Knight

    Dark Knight Jr. VIP Jr. VIP Premium Member

    Joined:
    Nov 15, 2009
    Messages:
    731
    Likes Received:
    1,194
  2. dukeofism

    dukeofism Junior Member

    Joined:
    Dec 14, 2009
    Messages:
    183
    Likes Received:
    79
  3. MrBlue

    MrBlue Senior Member

    Joined:
    Dec 18, 2009
    Messages:
    950
    Likes Received:
    662
    Occupation:
    Web/Bot Developer
    Copy the following into a text file and save it as ".htaccess"
    Place the file in your site's root directory.

    Code:
    Options +FollowSymLinks
     
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
     
  4. Bel fiore

    Bel fiore Newbie

    Joined:
    May 24, 2009
    Messages:
    43
    Likes Received:
    6
    Location:
    Outlaw
    I never had a problem with any domains not automatically working as both
     
  5. poolhall

    poolhall Newbie

    Joined:
    Jan 8, 2010
    Messages:
    26
    Likes Received:
    6
    You can do this either in your apache config file or in your htaccess file if you don't have access to the apache config file.

    Here's an example of what you can put in the apache config file:

    Code:
    <VirtualHost *:80>
        ServerName example.com
        ServerAlias www.example.com
        
        RewriteEngine on
        RewriteCond %{HTTP_HOST} !^www
        RewriteRule (.*) http://www.example.com$1 [R=301,L,QSA]
        
        [...]
    </VirtualHost>
    Or put this in your .htaccess file
    Code:
        RewriteEngine on
        RewriteCond %{HTTP_HOST} !^www
        RewriteRule (.*) http://www.example.com$1 [R=301,L,QSA]
     
  6. magnolia3

    magnolia3 Junior Member

    Joined:
    Mar 31, 2008
    Messages:
    116
    Likes Received:
    30
    If your site is using Wordpress, just go to Settings> General > and add www to your domains on the field. that will work.
     
  7. 730promo

    730promo Junior Member

    Joined:
    Aug 27, 2009
    Messages:
    130
    Likes Received:
    12
    Occupation:
    Music Management and Marketing
    Location:
    Reading
    Home Page:
  8. blackplastic

    blackplastic Newbie

    Joined:
    Jan 18, 2010
    Messages:
    7
    Likes Received:
    0
    Make sure there's an A or CNAME record before you make the switch! To test, just open a cmd prompt or loonix shell and type:



    Windows:

    Code:
    nslookup www.yourdomain.com
    Linux:
    Code:
    # dig @8.8.4.4 www.yourdomain.com A
    # dig @8.8.4.4 www.yourdomain.com CNAME