Disable ONLY URL auto complete, not the whole canonical URL system
I have a blog with several pages in some category “projects” that are structured/named like this:
- /projects/project-2012
- /projects/project-2013
- /projects/project-2014
- /projects/project-2015
When a user enters URLs like http://myblog.com/project or even http://myblog.com/proje he/she is redirected to the page /projects/project-2012. (With a 301 Moved Permanentely!)
While I want wordpress to turn URLs resulting in one clearly defined page (e.g. like http://myblog.com/?p=123) into the canonical form, I want to disable only the URL auto-completion for “unclear” URLs that might point to several pages.
My question is: How can I accomplish this?
I also did some research…
-
The accepted answer to the question
Disable WordPress URL auto complete
disables the whole canonical URL system. This is not acceptable for
me. -
About four years ago something like this popped up on the WordPress bug tracker: https://core.trac.wordpress.org/ticket/8948 While some good solutions (like offering a page “We did not found your URL. But were you maybe looking for one of the following pages?”) were discussed there, the ticket was closed in the end.
-
EDIT: There is actually a newer ticket at https://core.trac.wordpress.org/ticket/16557 which covers exactly what I need. It seems to be targeted for the 4.0 release. And the ticket comments also contain a solution (see below).
Leave an answer
You must login or register to add a new answer .