How to Use 301 Redirect for .php

Discussion in 'Search Engine Optimization' started by chatpartner, Feb 28, 2008.

  1. #1
    Hello Members,

    I have site like abc.com and this site index in google. This site having default page with name index.php , its also index in Google that doing duplicate.

    I want to use 301 301 permanent redirection from www.abc.com/index.php to www.abc.com

    Please give me code for .php

    thanks...
     
    chatpartner, Feb 28, 2008 IP
  2. charroseo

    charroseo Peon

    Messages:
    293
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think this code can work

    <?php
    // Permanent redirection
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://www.yoursite.com");
    exit();
    ?>
     
    charroseo, Feb 28, 2008 IP
  3. akashdwivedi

    akashdwivedi Guest

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi,

    Plz find text attachment with this post.

    Rename it to '.htaccess'

    Edit your website name in the file by replacing yourwebsite.com to your website name and upload the same to the rot of your website.

    All the best
     

    Attached Files:

    akashdwivedi, Feb 29, 2008 IP
  4. devat

    devat Peon

    Messages:
    670
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    hello

    i m agree with charroseo
     
    devat, Feb 29, 2008 IP
  5. Pixelrage

    Pixelrage Peon

    Messages:
    5,083
    Likes Received:
    128
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Pixelrage, Feb 29, 2008 IP
  6. trichnosis

    trichnosis Prominent Member

    Messages:
    13,785
    Likes Received:
    333
    Best Answers:
    0
    Trophy Points:
    300
    #6
    trichnosis, Feb 29, 2008 IP