title: Redirect direct access to COM-Domain to English site
body: <p>I want to redirect a direct access to the website to its English content. Do you see any problem or improvement of my code?</p>
  
  <pre><code>/* 
   * Load English page if *.com domain
   */
  $domain = $_SERVER['SERVER_NAME'];
  $extension = pathinfo($domain, PATHINFO_EXTENSION);
  if($extension == "com" &amp;&amp;
     !preg_match('/'.$domain.'/', $_SERVER['HTTP_REFERER']) &amp;&amp;
     $_SERVER['REQUEST_URI'] == '/'){
  
          header('Location: /en/');
          exit;
  
  }
  </code></pre>
  
  <p>One problem I see is that if the users browser has <code>HTTP_REFERER</code> deactivated he couldn't access to <code>http://domain.com</code>. Is there a better solution? </p>
  
  <hr>
  
  <h2>EDIT</h2>
  
  <p>Here example of the usage:</p>
  
  <ul>
  <li>direct access to <code>http://domain.com</code> should be forwarded to <code>http://domain.com/en/</code></li>
  <li>If the the user clicks the link to the base <code>&lt;a href='/'&gt;home&lt;/a&gt;</code> or <code>&lt;a href='http://domain.com'&gt;home&lt;/a&gt;</code> it should not be redirected.</li>
  </ul>