Rewrite/Redirect 所有 "someaddress.html" 页面到 "someaddress/" WordPress

Rewrite/Redirect all "someaddress.html" pages to "someaddress/" WordPress

我最近迁移了我的网站 - 此迁移的一部分是从静态 html 更改为 wordpress 网站。我所有指向我网站的链接仍然使用以下方案:mysite.com/{year}/{month}/somepost.html 而我的新方案是 mysite.com/{year}/{month}/somepost/

如何使用 mod_rewrite 所有具有旧模式的 URL 重定向 (301) 到新模式?

使用 mod_rewrite 您可以设置 .htaccess 文件以通过以下方式将传入链接从 http://example.com/2004/04/title_of_post.html 重定向到 http://example.com/2004/04/title-of-post/

RewriteEngine on
RewriteRule ^([0-9]{4}/[0-9]{1,2}/.*)\.html / [R=301,L]

wordpress也有插件,你可以看看link