Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm having this strange problem on my latest working project. It's really weird, like Wordpress is ignoring 404.php theme file on occasions, and specifically:

  • domain.com/a-post-name-does-not-exists/ redirects to theme's index.php ( 200 response header )
  • domain.com/parent-page/child-page-both-dont-exist/ redirects to 404.php ( 404 response header )
  • domain.com/28page-doesnt-exist/ redirects to 404.php ( a random permalink starting with any number!! found it by mistake ) ( 404 response header )

In my setup, the permalinks are /%postname%/ and the WP is installed on the root folder of the account. I'm using a static page as my homepage ( so the theme's index.php is really not needed ).

My .htaccess is pretty standard:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

I've pretty much search everything regarding this issue. Tried disabling plugins, testing the installation on a different location and reloaded permalink settings many times. The only thing i haven't tried was switching themes, but i did "scanned" every function of the theme for anything weird being filtered/hooked regarding permalinks or redirects.

At first i thought this had something to do with the site using Greek permalinks, but the problem happens regardless latin or greek characters being used in the URL.

I could throw 404.php contents into index.php as a quick fix, but that would be totally wrong as the headers wouldn't be 404 - not found.

share|improve this question
What displays in the first case, when it's just a non-existent post name? – m0r7if3r Jan 23 '12 at 16:04
We would need more specific details about the actual URLs being used and the layout of your site. Pretend examples aren't good enough. Probably the redirect_canonical or the redirect_guess_404_permalink functions are confused by your specific setup and layout. WordPress tries very hard to guess what the URL should be and to redirect the person there. This is mostly for search engine benefits. – Otto Jan 24 '12 at 6:15
@m0r7if3r it loads the theme's index.php ( checked it by echoing dummy text on different templates ) – netfreak Jan 24 '12 at 9:17
@Otto Those pretend examples are actually been tried as mentioned and produce these results, but i get what you're saying. Any inputs on what details would be helpful? thanks :) – netfreak Jan 24 '12 at 9:19

closed as too localized by toscho Dec 24 '12 at 21:54

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

1 Answer

Some servers have issues with 404..
you should try add this to the htaccess:

ErrorDocument 404 /index.php?error=404

If your wordpress is inside a directory dont forget
to make a relative path.. like so:

ErrorDocument 404 /directoryname/index.php?error=404

Hope this helps...
Cheers, Sagive

Revised: create a page with the permalink of 404 and add this to your .htaccess..

ErrorDocument 404 /index.php/pages/404/

** Make sure to change this adress to whatever the page url / structure is..

share|improve this answer
Thanks for the input, i've tried that already ( from the start actually ) but didn't really changed anything. – netfreak Jan 24 '12 at 9:21
in that case where the website refirects you to your homepage does the title shows 404 ?? – Sagive SEO Jan 25 '12 at 14:17
No, the title remains as the site's name - nothing else and also the header response is 200 OK. – netfreak Jan 27 '12 at 10:59
added another way to go about it.. (see revised section in my original answer – Sagive SEO Jan 27 '12 at 12:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.