.htaccess redirection

Discussion in 'Search Engine Optimization' started by taham, Aug 13, 2010.

  1. #1
    taham, Aug 13, 2010 IP
  2. seo4me

    seo4me Well-Known Member

    Messages:
    209
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    123
    #2
    this thread has been posted many times: search it you will get the answer with code
    :)
     
    seo4me, Aug 13, 2010 IP
  3. tomecki

    tomecki Peon

    Messages:
    369
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Try this:

    Redirect to www (htaccess redirect)

    Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to www.domain.com
    The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

    Options +FollowSymlinks
    RewriteEngine on
    rewritecond %{http_host} ^domain.com [nc]
    rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

    Please REPLACE domain.com and www.newdomain.com with your actual domain name.
     
    tomecki, Aug 13, 2010 IP
  4. PlasmaInstalls

    PlasmaInstalls Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi,

    I am agree with tomecki as suggested with .htaccess code.
     
    PlasmaInstalls, Aug 13, 2010 IP
  5. taham

    taham Peon

    Messages:
    97
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks tomecki for providing this code.
     
    taham, Aug 13, 2010 IP