301 redirect not working

Discussion in 'Apache' started by BrianR2, Jan 25, 2007.

  1. #1
    Hi,
    I'm trying to redirect http://www.site.com/index.php to http://www.site.com/ but I keep getting this error even from http://www.site.com/:

    but I didn't change anything to do with cookies.

    The .htaccess file is in the root folder and looks like this:

    
    AddType application/x-httpd-php .php .php3 .phtml .html
    php_value mysql.connect_timeout 45
    
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^index.php$ http://www.site.com/ [R=301,L]
    
    Code (markup):
    Anyone know what's wrong?
     
    BrianR2, Jan 25, 2007 IP
  2. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I guess since the index of the / folder will be index.php, it will always redirect. Try using a REQUEST_URI instead -
    RewriteCond %{REQUEST_URI} ^/index.php
    RewriteRule ^index.php$ http://www.site.com/ [R=301,L]
    Code (markup):
     
    rodney88, Jan 27, 2007 IP