Made rewrite more consistent with the ErrorDocument solution