Skip to main content
Tweeted twitter.com/#!/StackWordPress/status/111963602428243968
edited body
Source Link
supertrue
  • 3k
  • 10
  • 45
  • 60

Wordpress sometimes "guesses" a redirection for a nonexistent page slug if the slug is at the contained inbeginning of another URL. After some searching, my hypothesis is that this part of the canonical redirection functionality, which can be disabled using this code:

remove_filter('template_redirect', 'redirect_canonical'); 

However, I like the idea of canonical redirection, and would prefer not to turn it off entirely. Is there a way to only disable the slug "guessing"? I would prefer a 404 over an incorrect 301.

Wordpress sometimes "guesses" a redirection for a nonexistent page slug if the slug is at the contained in another URL. After some searching, my hypothesis is that this part of the canonical redirection functionality, which can be disabled using this code:

remove_filter('template_redirect', 'redirect_canonical'); 

However, I like the idea of canonical redirection, and would prefer not to turn it off entirely. Is there a way to only disable the slug "guessing"? I would prefer a 404 over an incorrect 301.

Wordpress sometimes "guesses" a redirection for a nonexistent page slug if the slug is at the beginning of another URL. After some searching, my hypothesis is that this part of the canonical redirection functionality, which can be disabled using this code:

remove_filter('template_redirect', 'redirect_canonical'); 

However, I like the idea of canonical redirection, and would prefer not to turn it off entirely. Is there a way to only disable the slug "guessing"? I would prefer a 404 over an incorrect 301.

Source Link
supertrue
  • 3k
  • 10
  • 45
  • 60

Stop Wordpress from "guessing" redirects for nonexistent URLs

Wordpress sometimes "guesses" a redirection for a nonexistent page slug if the slug is at the contained in another URL. After some searching, my hypothesis is that this part of the canonical redirection functionality, which can be disabled using this code:

remove_filter('template_redirect', 'redirect_canonical'); 

However, I like the idea of canonical redirection, and would prefer not to turn it off entirely. Is there a way to only disable the slug "guessing"? I would prefer a 404 over an incorrect 301.