There's only the normal html after this on the page, with a meta refresh as it's a jump page. I don't think that would cause any problems:
<META HTTP-EQUIV=Refresh CONTENT="1; URL=<? echo $w; ?>">
Even stripped down to the code in msg:4485169 it's not working out. It's possible there's something wrong with my htaccess, as even normal invented urls that should 404 don't soon after I try fiddling with this, though normally there's no problem there.
Command lines and php aren't my strong point so looks like I should get professional help on this one. Thanks guys!