title: Get subdomain name with .htaccess file
body: <p>I'm working in a site where each user has own subdomain.
  And i need that user can only see some images, depending on the subdomain name.
  So for example:
  user1.domain.com should get images inside a folder root/images/user1/
  and
  user2.domain.com should get images inside a folder root/images/user2/</p>
  
  <p>I use similar like this:</p>
  
  <pre><code># For security reasons, Option followsymlinks cannot be overridden.
  #Options +FollowSymLinks -MultiViews
  Options +SymLinksIfOwnerMatch -MultiViews
  # Turn mod_rewrite on
  RewriteEngine On
  RewriteBase /
  
  RewriteCond %{HTTP_HOST} ^temp\.domain\.com$ [NC]
  RewriteRule ^$ /logo-base.png [L]
  
  RewriteCond %{DOCUMENT_ROOT}/access_temp_files/$1 -f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /access_temp_files/$1 [L]
  
  RewriteCond %{DOCUMENT_ROOT}/access_temp_files/$1 !-f
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /pic-base.png [L]
  </code></pre>
  
  <p>in this case when url is temp.domain.com/image.png it gets the image at root/access_temp_files/image.png and if do not exists print pic-base.png at root/</p>
  
  <p>So i need the same thing but i need to get the subdomain name
  and use it in diferent places, for example replacing "temp" and "access_temp_files", like this:</p>
  
  <pre><code># replacing "temp" with subdomain name in: RewriteCond %{HTTP_HOST} ^temp\.domain\.com$ [NC]
  RewriteCond %{HTTP_HOST} ^(subdomainname)\.domain\.com$ [NC]
  
  # replacing "access_temp_files" with subdomain name in: RewriteCond %{DOCUMENT_ROOT}/access_temp_files/$1 -f
  RewriteCond %{DOCUMENT_ROOT}/(subdomainname)/$1 -f
  </code></pre>
  
  <p>How can i get subdomainname in .htaccess file?</p>
  
  <p>I hope that is not too confusing to understand :)</p>
  
  <p>Thank you.</p>