永久链接从%day%更改为%id%后,Wordpress 301重定向

永久链接从%day%更改为%id%后,Wordpress 301重定向

问题描述:

On a Wordpress blog, with posts permalink setup like this: /%year%/%month%/%day%/%post_name%/

How to massively change the permalinks to this: /%post_name%-%post_id%/. I have about 10,000 articles.

  1. Change the permalink from wordpress settings - done.
  2. Create a redirection for all link /1970/01/01/this_is_a_post/

How to do the step 2?

People will arrive on /1970/01/01/this_is_a_post but they will find a 404 as the post is now under /this_is_a_post-00022.

在Wordpress博客上,使用帖子 em>永久链接设置如下: /% 年%/%月%/%天%/%post_name%/ code> p>

如何将永久链接大量更改为: /%post_name% - %post_id% /. 我有大约10,000篇文章。 p>

  1. 更改wordpress设置的固定链接 - 完成。 li>
  2. 创建重定向 所有链接 / 1970/01/01 / this_is_a_post / code> li> ol>

    如何执行第2步? p> \ n

    人们将到达 / 1970/01/01 / this_is_a_post code>,但是他们会找到一个404,因为帖子现在在 / this_is_a_post-00022 code>下。 p > div>

Try this...

  1. Download the WordPress Simple 301 Redirect plugin: https://wordpress.org/plugins/simple-301-redirects/
  2. Create a redirect and enter the following in the request field: /%year%/%month%/%day%/%post_name%/ and the following in the destination field: /%post_name%-%post_id%/
  3. Voila! You're all done.