Commenters

ah wei akmal annoymous iera Jay Rod josh Mike victor loya Vringo yumi :) 'triple N'

 

Latest Comments

 

Subscription

Subscribe to ChronoSight's feed now or get it right from your e-mail.

 

Disable 404 Header Response for WordPress

Posted by crynobone. on 30-January 2008. Filed under , and . View:693 Comment:0

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] 

0 comments so far...

Be the first to comment.

Comment something...

Everything have a rules, so does our commenting:

  • * is required.
  • Don't provide any external links if you are posting for the first time!
  • Returning commentor can post total of 4 external links.
Name *
Website
Email *

Shout something...

Name
Website
Email