301 redirect help...http://site.com to http://www.site.com

Discussion in 'Programming' started by pratikgmr, Jun 22, 2007.

  1. #1
    Hi, can anyone help me with 301 redirect for my wordpress blog.....


    I saw other threads discussing this and I tried those codes but they messed up my site.....

    Here is what i have in my .htaccess right now.....

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress



    What should I add to this to redirect http://mysite.com to http://www.mysite.com

    Thanks
    PratikGmr
     
    pratikgmr, Jun 22, 2007 IP
  2. pratikgmr

    pratikgmr Active Member

    Messages:
    531
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Hi...I solved it....it is working now
    just added
    RewriteCond %{http_host} ^site.com [nc]
    RewriteRule ^(.*)$ http://www.site.com/$1 [r=301,nc]

    PratikGmr
     
    pratikgmr, Jun 22, 2007 IP