My website old permalink http://example.com/postid.html . Now I changed my permalink structure to http://example.com/postname .

My old link which is now 404.

I tried using Yoast Generator and redirect plugin for .htaccess code for 301 redirect and updated my .htaccess but the problem not solved yet.

May I know how can I 301 redirect all my Old post postid.html to new post postname?

Thanks in advance.

1 Answer 1


After a bit of googling, I myself sorted out.

Just add the following line in your .htacess

RedirectMatch 301 ^/(\d+).html$ http://sitename.com/?p=$1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.