• Resolved sueme

    (@sueme)


    I’ve recently changed a site to WordPress 3 from Drupal, and I’ve managed to keep all the existing links working with one notable exception.

    I’ve got quite a few incoming links to index.html (which now doesn’t exist).

    Is there a way of redirecting from index.html to (I assume) index.php?

    I’m using WordPress3 with the TwentyTen Theme and Permalinks. I’m also using the All in One SEO Pack plugin.

    Can anyone please help, or point me in the right direction.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter sueme

    (@sueme)

    More info:

    My existing .htaccess reads as follows:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    I did a Google search, and it looks as though I may be able to add the following to the .htaccess:

    Options +FollowSymLinks
    RewriteCond %{THE_REQUEST} ^.*/index.html
    RewriteRule ^(.*)index.html$ https://www.yoursite.com/$1 [R=301,L]

    However, I’m not fully sure how to do this and don’t want to screw things up.

    Where exactly do I add the second bit of code to the first bit?

    Can anyone tell me please?

    Thread Starter sueme

    (@sueme)

    OK Sorted.

    Putting the new code under the existing code doesn’t appear to work, but putting the new code at the top does work.

    Presumably it diverts index.html to index.php first, then activates the rest of the code.

    The full code that works is:

    RewriteCond %{THE_REQUEST} ^.*/index.html
    RewriteRule ^(.*)index.html$ https://mysite.com/$1 [R=301,L]
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    Thanks a lot for posting this. I was having the same problem and this did the trick.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Redirect from index.html to index.php’ is closed to new replies.