301 redirect of /index.html to homepage

Discussion in 'Apache' started by dimmakherbs, May 20, 2009.

  1. #1
    I changed my site from static html to wordpress. I had some really good and strong backlinks that are pointing to /index.html and google finds this as a 404 page.
    How can I redirect to the main page (index.php?), the simple 301 redirect doesn't work here.

    thanks
     
    dimmakherbs, May 20, 2009 IP
  2. yonghoshin

    yonghoshin Peon

    Messages:
    70
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Put this in before the WordPress part in your .htaccess:

    RewriteRule ^/index.html$ / [R=301]
     
    yonghoshin, May 21, 2009 IP
  3. dimmakherbs

    dimmakherbs Active Member

    Messages:
    1,330
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    90
    #3
    this didn't seem to work, although it also didn't make an error either.
     
    dimmakherbs, May 21, 2009 IP
  4. dimmakherbs

    dimmakherbs Active Member

    Messages:
    1,330
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    90
    #4
    anyone have an idea on this?
     
    dimmakherbs, May 29, 2009 IP
  5. wjb316

    wjb316 Active Member

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    88
    #5
    Hey I moved from a static .html to WordPress and had the same problem.

    I did a lot of searching around and this is the best I found. But please note that I am an htaccess newb and do not promise anything with this code. All I know is that it redirects visitors from index.html to www.site.com

    RewriteCond %{HTTP_HOST} ^YourDomain\.com$ [NC]
    RewriteRule ^(.*)$ http://www.YourDomain.com/$1 [R=301,L]


    Edit - It may also be this line of code:

    RewriteRule ^(.*)index\.html$ $1 [R=301,L]


    Sorry man, I don't know which line of code does it but after a quick glance it must be one of those.
     
    wjb316, Jun 2, 2009 IP