It seems to need a refresh after the first visit to each of the pages/categories to the search query replace thing to work. The header is an .swf, so there are two places where the url is given. This is what I have in those places:
<?php
if(is_home()){ echo '<param name="movie" value="https://mydomain.com/file.swf" />';}
else if(is_category(array(4, 7, 8, 9))){ echo '<param name="movie" value="https://mydomain.com/file.swf?portfolio=1" />';}
else if(in_category(array(4, 7, 8, 9))){ echo '<param name="movie" value="https://mydomain.com/file.swf?portfolio=1" />';}
else if(is_page(array("Skills", 2))){ echo '<param name="movie" value="https://mydomain.com/file.swf?about=1" />';}
else { echo '<param name="movie" value="https://mydomain.com/file.swf" />';}?>
and
<?php
if(is_home()){ echo '<object type="application/x-shockwave-flash" data="https://mydomain.com/file.swf" width="575" height="28">';}
else if(is_category(array(3, 4, 7, 8, 9))){ echo '<object type="application/x-shockwave-flash" data="https://mydomain.com/file.swf?portfolio=1" width="575" height="28">';}
else if(in_category(array(3, 4, 7, 8, 9))){ echo '<object type="application/x-shockwave-flash" data="https://mydomain.com/file.swf?portfolio=1" width="575" height="28">';}
else if(is_page(array("Skills", 2))){ echo '<object type="application/x-shockwave-flash" data="https://mydomain.com/file.swf?about=1" width="575" height="28">';}
else { echo '<object type="application/x-shockwave-flash" data="https://mydomain.com/file.swf" width="575" height="28">';}
?>