Disable 404 Header Response for WordPress
I have a numbers of project running on WordPress and each of it extend the functionality of WordPress using plugin or integration with 3rd party application (which I would be able to share as for now). However, WordPress tend to send 404 header response to the browser which is may break your code or disable access to the 3rd party application.
Based on my experience, if your browser have search engine related extension or plug-in, those plug-in will take over the page and redirect it to their search engine result page. The 404 error status also bad as search engine crawler will assume that the page doesn't exist and therefore ignore it all together, which is bad if you want your application to be indexed.
To disable this all you need to do is browse to /wp-includes/classes.php and get to line 276 and 277. These following code should be there.
$wp_query->set_404();
status_header( 404 );
All you need to do is comment the two line.
//$wp_query->set_404();
//status_header( 404 );
Simple, isn't it. If you can find a better way to do this drop us a comment and share your knowledge with us.
If the problem still persist you can also opt to add this following code to your .htaccess file.
ErrorDocument 404 default
and modify
RewriteRule . /index.php [L]
to
RewriteRule ^(.+)$ /index.php/$1 [L]









