Here's a noob question...www.domain.com instead of domain.com

Discussion in 'Site & Server Administration' started by TheGrecianHero, Aug 29, 2008.

  1. #1
    TheGrecianHero, Aug 29, 2008 IP
  2. Altfuns

    Altfuns Member

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #2
    Add 'www' as a CNAME entry in the DNS Zone for your domain pointing to 'domain.com.'
    Also, make sure your webserver answers to both hostnames, domain.com and www. domain.com, at the same directory.
     
    Altfuns, Aug 29, 2008 IP
  3. shuttle

    shuttle Active Member

    Messages:
    429
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #3
    you have to add this in your db record:

    name ttl class rr canonical name
    www IN CNAME joe.example.com.

    You will need to do it as shown in the example so that the www works for your domain name

    you can read more about it here
     
    shuttle, Aug 29, 2008 IP
  4. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #4
    If this is a Wordpress blog, you'll need to set the 'siteurl' and 'home' variable in phpMyAdmin or your wp-admin/ to include the www.

    If this is not Wordpress, you can use this mod_rewrite rule:

    
    # Require WWW
    # Will automatically redirect requests to non-www to www
    # This will exempt robots.txt for search engines
    <IfModule mod_rewrite.c>
      Options +FollowSymLinks
      RewriteEngine On
      RewriteBase /
      RewriteCond %{REQUEST_URI} !^/robots\.txt$
      RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)$ [NC]
      RewriteRule ^(.*)$ http://www.%1.%2/$1 [R=301,L]
    </IfModule>
    
    Code (markup):
     
    zacharooni, Sep 9, 2008 IP
    TheGrecianHero likes this.
  5. TheGrecianHero

    TheGrecianHero Well-Known Member

    Messages:
    622
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #5
    Oh man, thanks Zach! I'd always wondered how to do that easily in a wordpress blog...
     
    TheGrecianHero, Sep 13, 2008 IP
  6. stmiki

    stmiki Peon

    Messages:
    523
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks this helped me out too! Was looking for this same solution :)
     
    stmiki, Sep 13, 2008 IP