Reputation: 168
I have a bit of an odd issue.
I am porting an old, static, .htm based site to wordpress and I don't want to loose any of the indexed "juice" as the old site has been going for 5years or so.
I am using the following line in my htaccess to redirect all *.htm to their wordpress equivalents.
RedirectMatch 301 ^(.*)\.htm$ $1/
This is working fine on every page apart from the index page which insists on redirecting to /index/ when I navigate to http://www.siteurl.com
My full htaccess looks like this
RedirectMatch 301 ^(.*)\.htm$ $1/
# 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 am using the /%postname%/ permalink structure (performance issues fixed in 3.3)
Upvotes: 0
Views: 909
Reputation: 9519
Try replacing your .htaccess with below. Every .htm page except index.htm (which I suspect is the default when you access the home page) will be redirected
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#if the page is not index.htm
RewriteCond %{REQUEST_URI} !index\.htm$ [NC]
#redirect it
RewriteRule ^(.+)\.htm$ $1/ [L]
# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>
Upvotes: 1