I have a site example.com
. When I try to load a URL example.coma
it will automatically redirect to example.comabout-me
page and the same for other letters as well. Is there a way to redirect all the non existing URLs to 404?
I have a site example.com
. When I try to load a URL example.coma
it will automatically redirect to example.comabout-me
page and the same for other letters as well. Is there a way to redirect all the non existing URLs to 404?
2
Answers
I think I found the solution!
Adding this to the function file solves the problem I am facing it's a new feature in WordPress 5.5+ version to auto-redirect to the nearest match URL if an incorrect URL is entered.
For older version of WordPress
And just adding the below code to .htaccess file will redirect you to a 404 custom page you have made or your theme has.
Or you can add a link directly like(worked for me)
WordPress automaticly handles invalid url requests. If invalid urls not redirect to 404 page you should check your .htaccess file. If WordPress can redirect default 404 page, you can edit your existing 404.php file or create new one. Here is redirect code for your 404.php file: