Add Nginx to your generator (or at least to the article).
With my case, I want to change old permalink to new permalink, example in this case:
Old permalink: http://www.dorachan.xyz/2018/06/10/phat-tam-nguong-mo-nha-giao-duc-vi-dai-maria-montessori/
New permalink: http://www.dorachan.xyz/phat-tam-nguong-mo-nha-giao-duc-vi-dai-maria-montessori/
I add below code to nginx block:
rewrite "/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)" https://www.dorachan.xyz/$4 permanent;
Like this:
server {
# ....
root /home/user/apps/dorachan;
index index.php index.html index.htm;
server_name dorachan.xyz www.dorachan.xyz;
rewrite "/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)" https://www.dorachan.xyz/$4 permanent;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
# ....
}
rewrite "/([0-9]{4})/([0-9]{2})/(.*)" http://yourdomain.com/$3 permanent;
For year/month/day
:
rewrite "/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)" http://yourdomain.com/$4 permanent;
And archives:
rewrite "/archives/(.*)" http://yourdomain.com/?p=$1 permanent;