12. June 2011
von Blackbam

While using WordPress on IIS 7 we were confronted with the problem that post loops without results or 404 pages on IIS where redirecting to the ugly default 404 pages of IIS instead of leading us to the WordPress ones. The most obvious possibility to solve this problem is to change the IIS server configuration. Anyway I discovered that this 404 page redirection happens not till than WordPress starts sending its headers and only if there is no output until this event. So there is quite a funny hack to solve this problem - just send the XML-declaration (or anything else, like an empty string with whitespace) when the WordPress send_headers-action is performed, and the 404 pages will always be the WordPress ones.

function preventIIS404() {

Just be sure that you do not need to have any header()-redirections after this by plugins or your theme, because this will lead you to "Headers already sent"-errors.


Dieser Eintrag wurde am 12. June 2011 um 16:16 in der Kategorie WordPress, WP Scripts veröffentlicht. You can book the comments for this article RSS 2.0. Feedback, discussion, commendation and critics are welcome: Write a comment or trackback.

Tags: ,

Warning: Use of undefined constant Ext_related_links - assumed 'Ext_related_links' (this will throw an Error in a future version of PHP) in /home/.sites/609/site1266/web/blackbams-blog/wp-content/themes/SilentWoodsByBlackbam/single.php on line 75

No comments yet

Kommentare abonnieren (RSS) or URL Trackback

Leave a comment: