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.