how to setup .htaccess: redirect/ /%postname% to /%category%/%postname%

My current permalink structure is: %postname%

I'd like it to be: /%category%/%postname%

  • You shouldn't use HTAccess for changes like this, but, WP will do this automatically, it'll redirect to the canonical URL. So if you change your permalinks you've changed the canonical URL and it'll redirect to the new location. All you need to do is change your permalinks
    – Tom J Nowell
    Aug 13 '20 at 8:31
  • I have a lot of posts and when people click on a link they get an error 404. Aug 14 '20 at 8:02
  • To be honest, I would just throw in the Redirection plugin by John Godley and update the permalink structure. Or, if you have already changed them, set some rules in the plugin to handle your redirects. Aug 16 '20 at 15:29

Your Answer

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

Browse other questions tagged or ask your own question.