.htaccess redirect Error

Discussion in 'Site & Server Administration' started by djrishi, Jan 31, 2011.

  1. #1
    I was trying to do a 301 Redirect of my domain.com to http://www.domain.com to make it SEO friendly...

    However i got following error -
    ***********
    Not Found
    The requested URL /public_html/ was not found on this server.
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    **********

    >htaccess content----- Please suggest

    RewriteEngine On
    Options +FollowSymLinks
    RewriteCond %{HTTP_HOST} !^www.pricenext.in [NC]
    RewriteRule ^(.*)$ http://www.pricenext.in/$1 [L,R=301]
    Code (markup):

     
    djrishi, Jan 31, 2011 IP
  2. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Try the following

    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    Code (markup):
     
    mwasif, Jan 31, 2011 IP
  3. dynashox

    dynashox Premium Member Staff

    Messages:
    8,662
    Likes Received:
    563
    Best Answers:
    3
    Trophy Points:
    335
    #3
    I always used this code format:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^yourdomain.com
    RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
    Code (markup):
    - Dynashox -
     
    dynashox, Jan 31, 2011 IP