I'm trying to
- make a PHP 302 redirect,
- set the Vary header and
- set the X-Robots tag
dependently on the screen width. The code snippet i have is
 <script language="javascript">
  if ( $(window).width() < 480 )
   {
     <?php
       {
        header('Vary: User-Agent');
        header("Location:'$_SERVER['REQUEST_URI'].'/index_mobile.html", true, 302);
        header("X-Robots-Tag: noindex,nofollow");
       }
     ?>
   }
 </script>
I don't use a simple Javascript redirect, because i must set the Vary header and additionally the redirect must be explicitly 302.
But it seems, this snippet doesn't work. Does somebody know, how i achieve the goals?
Thank you!
