0

I have changed the permalink from Post name to Custom Structure.

Earlier my blog links were like www.website.com/blog-post-link i want to change that to www.website.com/my-articles/blog-post-link so my custom structure permalinks looks as following and it does give me what I want

https://website.com/my-articles/%postname%/

However all the old links are now giving 404 error www.website.com/blog-post-link

What can I do so that old links get redirected to the new link and does not give page not found error. I have 100s of blog post, i hope i dont have to manually do a redirect for each blog post.

I came across this question but it does not seem to work for me

0

Well, if your /%postname%/ part stays the same, .htaccess redirection can help you pointing old urls to the new ones like this:

RewriteEngine On
RewriteRule ^$ /my-articles [R=301,L]

Put this into your .htaccess file and it should redirect http://your.tld/my-article to http://your.tld/my-articles/my-article.

Beware that this will redirect everything, not only some post types or sth. like that. But .htaccess is very powerful and gives you lot of options to redirect or rewrite URLs.

  • I am guessing this will redirect the pages as well for example website.com/contact to website.com/my-articles/contact, if yes then I am afraid this solution wont work – Saadia Aug 19 '15 at 10:44
  • Yes, .htaccess will redirect everything, just changing the permalink structure will not do that. Actually I just changed permalinks on one site this morning and the page URLs kept the same, post URLs changed. You might also want to read this: wpexplorer.com/change-permalinks-wordpress They are talking about a plugin which could help you further. – flomei Aug 19 '15 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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