How to Change Permalink Structure Safely

Currently, I am using since I migrated from Blogger to WordPress.

But now I want to change to since my posts are evergreen and date & month doesn’t look good in URL.

What’s the safest to do this without affecting backlinks, SEO, etc?

1 Like

@GulshanKumar if I’m not wrong then here we have to use regex redirect. but how you will do this when the value of is changing as per post. Looks like have to add 2-5 regex redirections rules.

1 Like

Add this code in the .htaccess file

# Replace with own domain
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(?!page/)(.+)$$4

No need to do anything at Settings>Permalinks?

1 Like

At WP, keep %postname% in advanced before adding above code.


can you explain this rewrite rule @GulshanKumar ?

1 Like

It will redirect from /%year%/%monthnum%/%day%/%postname%/ to /%postname%/ permalink.

I don’t have %day% in URL. Will this code work?

Oh sorry!

Then use this one

From Month and Name /%year%/%monthnum%/%postname%/
To to /%postname%/ permalink.

RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(?!page/)(.+)$$3

here this

and here this why?

It depends on how many things I am matching.

Mean I think by rule it’s $1 and your used another number so, I’m confused.