编辑WordPress .htaccess来处理博客文章固定链接更改

I'm trying to figure out how to edit the default wordpress .htaccess file to make a site migration work.

In the new WordPress version of the site, blog articles have permalinks set like this:

http://www.example.com/article-slug

On the old version of the site, they were like this:

http://www.example.com/living/blog/article-slug

I've tried several variations of this kind of rule:

RewriteRule ^living/blog/([A-Za-z0-9-]+)/?$ $1 [NC,L]

But it always results in a 404 error. Can anyone point me in the right direction?

Thanks!

In case it's useful, this was what worked:

RewriteRule ^living/blog(/.*)?$ ^$1 [L,R=301,NC]

Try to set desired url in Site Address field in Settings -> General administration page. That way it is not needed to change .htaccess manually.

From official documentation:

  • The "Site Address (URL)" setting is the address you want people to type in their browser to reach your WordPress blog.
  • The "WordPress Address (URL)" setting is the address where your WordPress core files reside.