permanent redirect (301)

Discussion in 'HTML & Website Design' started by Lookout, Oct 17, 2006.

  1. #1
    Hi,

    I want to redirect my http:// yourname.com to http:// www . yourname.com but when I place a permanent redirect (301) to the www the index page doesn’t work anymore. Does anybody know how to redirect from the http:// to the www.

    I only have this problem when I redirect to the same domain name

    Thanks
     
    Lookout, Oct 17, 2006 IP
  2. coolsaint

    coolsaint Banned

    Messages:
    257
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try This.

    <IfModule mod_rewrite.c> 
    Options +FollowSymLinks 
    RewriteEngine On 
    RewriteBase / 
    RewriteCond %{HTTP_HOST} . 
    RewriteCond %{HTTP_HOST}!^www\.example\.com 
    RewriteRule (.*) http://www.example.com/$1 [R=301,L] 
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*)index\.html\ HTTP/ 
    RewriteRule index\.html$ http://www.example.com/%1 [R=301,L] 
    </IfModule> 
    Code (markup):

    I wish it will help you to redirect all your www and no www traffice whether it is from visitors or search engine bot to www version of the site.
     
    coolsaint, Oct 18, 2006 IP
  3. Lookout

    Lookout Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It is running on a Linux server. I will try out your response.

    Thanks for the support.
     
    Lookout, Oct 18, 2006 IP