There are some cases that you want to change the permalink of your wordpress. Maybe for SEO reasons or whatever. In my case, I changed it from the custom permalink “%postname%-%year%%monthnum%%day%” to the usual “%postname%” permalink structure since the latter structure is much “TIME” friendly compare to my old structure. Time friendly because, the old permalink changes the post link whenever I change the publish date of the post which makes the old post with old date a 404 page due to the said changes. It was fine back then since I am not frequently changing the post date of my post so it does not matter back then but this time its different. So I decided to change this structure.

Back then before the new versions of WordPress, I tried to use Advanced Permalink plugin to this stuff but it the plugin is not working anymore. I’ve tried it for several times and it does not redirect the old permalink to the new one. So what I did is use redirect all the post to the new permalink structure using the .HTACCESS redirection.

The following is the redirection I added in .HTACCESS:

RedirectMatch 301 /(.*)-([0-9]+)/$$1

This code, redirects post like “” to “”

For structure like this: “” pointing to “”, you can try the following instead:

RedirectMatch 301 /([0-9]+)/([0-9]+)/(.*)/$$3

For NGINX users, you can try the following code instead for this purpose.

# nginx configuration
location ~ /(.*)-([0-9]+)/$ {
rewrite ^(.*)$$1 redirect;

Now to make sure this works, save again your new permalink structure to flush the new changes.

0 0 votes
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments