title: Redirect non-www to www not working
body: <p>I set up a virtual server using virtualmin, it didn't create the .htaccess file so I created one in the public_html folder and put the following code </p>
  
  <pre><code>RewriteEngine On
  RewriteCond % ^megahotserved.com [NC]
  RewriteRule ^(.*)$ http://www.megahotserved.com/$1 [L,R=301]
  </code></pre>
  
  <p>restarted apache and no effect and then tried </p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ServerName megahotserved.com
      Redirect permanent / http://www.megahotserved.com/
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>in the httpd.conf file, when I restarted apache firefox came up with an error</p>
  
  <blockquote>
    <p>The page isn't redirecting properly.</p>
    
    <p>Firefox has detected that the server is redirecting the request for this address in a way that will never complete.</p>
  </blockquote>
  
  <p>What should I do ?</p>