简体   繁体   English

.htaccess重写帮助以更改Wordpress永久链接

[英].htaccess rewrite help for wordpress permalink change

I need some help with an .htaccess rewrite. 我需要有关.htaccess重写的帮助。

I have a site that had this permalink: /archive/%post_id 我有一个具有此永久链接的网站: /archive/%post_id

and changed it to this: /%postname%/ 并将其更改为: /%postname%/

I have tried every single permalink redirect and change plugin - none of them work for this scenario. 我已经尝试了每个永久链接重定向和更改插件-在这种情况下它们都不起作用。

The site has 15,000 posts, adding one line 301 redirects in the .htaccess file isn't going to work. 该网站有15,000个帖子,在.htaccess文件中添加一行301重定向无法正常工作。

Can someone help me add a rewrite that will redirect all instances of /archive/%post_id to /%postname%/ ? 有人可以帮我添加一个重写,将/archive/%post_id所有实例重定向到/%postname%/吗?

any help appreciated! 任何帮助表示赞赏!

I know you said you tried all the plugins, but just in case, did you try this one: 我知道您说过您尝试了所有插件,但以防万一,您是否尝试过以下插件:

http://www.shoutmeloud.com/how-to-use-deans-permalink-migration-plugin-for-wordpress.html http://www.shoutmeloud.com/how-to-use-deans-permalink-migration-plugin-for-wordpress.html

Looks like it dynamically creates 301s for you without SEO damage. 看起来它会为您动态创建301,而不会造成SEO损坏。 Written in 2006, still working in 2009 - you might be able to tweak the code to get it working how you want. 写于2006年,至今仍在2009年工作-您可能可以调整代码以使其按预期工作。

If that is the 'quick' solution then the 'long' solution would be to write an app to lookup the postname by postid in your mysql db and then change each post URL in your wordpress database with the postname value. 如果那是“快速”解决方案,那么“长”解决方案将是编写一个应用程序以在mysql db中通过postid查找postname ,然后用postname值更改wordpress数据库中的每个post URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM