将旧的基于htm的站点重定向到wordpress permalinks

将旧的基于htm的站点重定向到wordpress permalinks,wordpress,.htaccess,redirect,Wordpress,.htaccess,Redirect,我有一个奇怪的问题 我正在将一个旧的、基于.htm的静态站点移植到wordpress,我不想失去任何索引的“果汁”,因为旧站点已经运行了5年左右 我在htaccess中使用以下行将所有*.htm重定向到它们的wordpress等价项 RedirectMatch 301 ^(.*)\.htm$ $1/ 这在每个页面上都可以正常工作,除了索引页面,它坚持在我导航到时重定向到/index/ 我的完全访问权限如下所示 RedirectMatch 301 ^(.*)\.htm$ $1/ # BEGIN

我有一个奇怪的问题

我正在将一个旧的、基于.htm的静态站点移植到wordpress,我不想失去任何索引的“果汁”,因为旧站点已经运行了5年左右

我在htaccess中使用以下行将所有*.htm重定向到它们的wordpress等价项

RedirectMatch 301 ^(.*)\.htm$ $1/
这在每个页面上都可以正常工作,除了索引页面,它坚持在我导航到时重定向到/index/

我的完全访问权限如下所示

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
RedirectMatch 301^(.*)\.htm$$1/
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress

我正在使用/%postname%/permalink结构(在3.3中修复了性能问题)

尝试将您的.htaccess替换为以下内容。除了index.htm(我怀疑这是访问主页时的默认值)之外的每个.htm页面都将被重定向

<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>   

重新启动发动机
重写基/
#如果页面不是index.htm
重写cond%{REQUEST_URI}!索引\.htm$[NC]
#重定向它
重写规则^(+)\.htm$$1/[L]
#开始WordPress
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress

标志已删除,请参阅常见问题解答