移动字preSS以不同的固定链接其他域不同、链接、preSS

2023-09-02 20:34:40 作者:「像迯跑の賊」

我想移动的Word preSS到其他领域,改变了固定链接。所以基本上我要的是从移动:oldsite.com/PostId-PostName.html到newsite.com/PostName /

I want to move Wordpress to another domain and also change the permalinks. So basically what I want is to move from: oldsite.com/PostId-PostName.html to newsite.com/PostName/

我知道这可以从的.htaccess做,但我不设法得到它的权利。你能帮帮我吗?

I know this can be done from .htaccess, but I don't manage to get it right. Can you please help me ?

推荐答案

这是它如何使用Apache的 mod_rewrite的:

This is how it can be done using Apache's mod_rewrite:

# Activate Rewrite Engine
RewriteEngine On
# redirect posts to new site
RewriteRule ^(d+)-([^/]+).html http://www.newsite.com/$2/ [R=301,NC,QSA,L]

这将只重定向像 oldsite.com/12345-very-interesting-post.html 网​​址。

This will ONLY redirect URLs like oldsite.com/12345-very-interesting-post.html.