0

By default WordPress is built to autocomplete similar URLs in order to avoid 404.

This is causing some issues because we recently developed a new website and we needed to redirect old links to the new ones by creating custom 301 rules in .htaccess file.

The old links are slightly different from the old ones and the first part of them are similar.

For instance, if we make a redirect like this in .htaccess:

Redirect 301 /stat/param_taram/2009/ /statistics/param-taram/2009-abc/

WordPress is redirecting us to /statistics/param_taram/2009/ which does not exist. As we can see, it tried to redirect the first part of URL from /stat/ to /statistics/ but did not looked for the rest of URL which is causing a 404

I searched for any available solutions posted on https://core.trac.wordpress.org/ticket/16557 and also on StackExchange but any of those solutions did not helped for my situation.

Any suggestions on how to fix this?

  • 1
    Your description doesn't entirely make sense- your htaccess redirect happens before WordPress is even loaded, so I'm not sure how that is then sending you to a 3rd URL. WordPress does a LIKE query on post slug when trying to guess the match, no other part of the URL matters aside from what it thinks is the post slug. – Milo Apr 20 '18 at 17:25
  • Well okay but this is that what happens on my situation and I am not sure what could be other cause - where to look for? – twelvell Apr 21 '18 at 19:55

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.