This stuff is driving me nuts. The following url does NOT exist and should return a 404:
http://www.easyjob.net/resume/
However, if I try to access it, I get a 301 to http://www.easyjob.net/r/cover-letter/resume-and-cover-letter/
Even if I add a redirect to the .htaccess to redirect it somewhere else, I still get the * 301 to http://www.easyjob.net/r/cover-letter/resume-and-cover-letter/ again.
Anybody knows what’s going on?
PS this is the .htaccess:
AddHandler php5-script .php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
#/RESUME/
Redirect http://www.easyjob.net/resume/ http://www.easyjob.net/r/ [R=301,NC,L]
If you remove your Redirect from the .htaccess file, you could try adding a custom 404.php template file to your theme. I’m not sure exactly what you are asking. Do you want the page to Redirect, or do you want a custom 404 page that displays similar items?
To achieve the show similar posts using the 404.php template try this:
Create a php file named 404.php
Add this to the file and save it, then upload it to your theme directory:
NOTE:
You will need to replace the div’s I’ve used with the ones your theme has or it won’t look like the rest of your website. Open your index.php file and replace the
<div class="container">
and<div class="content">
from my file with your theme’s div’s.I agree with @Matthew Xerri’s answer and a better solution might be to only remove the canonical redirect filter when the page that will be shown is a 404 page.
This post explains how this can be done: http://scottnelle.com/642/prevent-wordpress-guessing-users-hit-404-error/
Essentially, it will only remove the filter if the page that should be shown is a 404 page.
Alternatively you could write it a bit differently by taking bits from this issue: https://wordpress.stackexchange.com/a/227043
Adding
will create more problems than solve because that will enable other sorts of urls. http://www.easyjob.net/ and http://www.easyjob.net/index.php will be accessible and that is very bad for SEO since you have to pages showing the same content. I am looking for a solution to stop WordPress from redirecting misspelled URLs and will update you I find one
The answer is probably kind of late, but if anyone come accross the same problem then you should try the following plugin: WP 404 auto redirect to similar post.
Long story short, the plugin use the
template_redirect
filter and check if a 404 is about to be displayed. If so, it will explode the URL and look for a similar post / taxonomy / post type.Hope it helps!