Help with permanent redirect from .php -> .html

Discussion in 'Apache' started by serendipity, Jan 10, 2006.

  1. #1
    I know this should be simple and that I must be missing something basic.
    I want to permanently redirect from
    http://www.csectionrecovery.com/folder.php?id=1
    to:
    http://www.csectionrecovery.com/books.html

    I tried this line in my .htaccess file:
    redirect 301 /folder.php?id=1 http://www.csectionrecovery.com/books.html

    but it just seems to ignore it. Other simple tests like this one work fine:
    redirect 301 /123 http://www.csectionrecovery.com/books.html

    Currently google has an assortment of php URLs indexed and cached - and I want to make sure it eventually crawls and caches my new .html versions of these pages so I can get rid of the dynamic .php version.

    Any tips?
    Thanks!
    Jeanne
     
    serendipity, Jan 10, 2006 IP
  2. Caveman

    Caveman Peon

    Messages:
    591
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try the following:

    
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^/books.html folder.php?id=1 [r=301,nc]
    Code (markup):
    Dont forget to change yoursite.com in the code to your real url.
     
    Caveman, Jan 21, 2006 IP