Blank Page when using IIS Permalink hack

I use Pretty WordPress Permalinks on IIS when I need to install WP on a windows server, but on one host I ran into a problem where I would get a blank page if the post didn’t exist instead of the theme’s 404 template. But for some reason it works fine if I just echo something in wp-404-handler.php. I echoed out an HTML comment so it wouldn’t disturb the layout. Here’s my new version of the file:

<?php
echo "<!-- If the page doesn't exist I get a blank screen unless I echo something -->";
$qs = $_SERVER['QUERY_STRING'];
$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'] = substr($qs, strpos($qs, ':80')+3);
require_once('index.php');
?>

Leave a Reply

Your email address will not be published. Required fields are marked *