I have a site running on WordPress, and it will automatically redirects URLs it thinks are written incorrectly.
For example, if I go to a URL that doesn't exist. Like this one:
www.example.com/blah-blah/my-page-slug/
will redirect me to...
www.example.com/my-page-slug/
How can I stop this redirection? I want to generate a 404 error if the wrong URL is typed in, not redirect.
Place this in your theme's functions.php
file.
remove_action('template_redirect', 'redirect_canonical');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With