title: htaccess wildcard subdomain rewrite without infinate loop
body: <p>I want anything.domain.co.uk to go to a php script which then uses the 'anything' from the url within the html to create different headers for example.
  This is the script in my .php file for this</p>
  
  <pre><code>&lt;?php echo array_shift(explode(".",$_SERVER['HTTP_HOST']));?&gt;
  </code></pre>
  
  <p>I have used the script below but it creates a loop obviously.
  How do I get anything.domain.co.uk to pick up the php script, still have anything.domain.co.uk in the url and also have www.domain.co.uk go to 'normal' index page </p>
  
  <pre><code>Options +FollowSymlinks -MultiViews
  RewriteEngine on
  
  RewriteEngine On
  RewriteBase /
  RewriteCond %{HTTP_HOST} !www.domain.co.uk$ [NC]
  RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.co.uk [NC]
  RewriteRule (.*) http://%2.domain.co.uk/$1 [R=301,L]
  </code></pre>