title: htaccess rewrite to https is adding unwanted folder
body: <p>I don't normally use Apache and I am struggle to get a rewrite rule working.</p>
  
  <p>The root folder contains a folder called public_html, when you browse to the website it loads as expected, I assume Apache automatically finds the index file inside the public_html folder. The problem I have is when adding the rewrite rule from http to https it adds the public_html to the url and a Not Found error is produced.</p>
  
  <p>This is the rewrite rule I was using:</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTP:X-Forwarded-Proto} !https
  RewriteRule ^(.*)$ https://exampledomain.com/$1 [R=301,L]
  </code></pre>
  
  <p>The url produced is something like this:</p>
  
  <pre><code>https://www.exampledomain.com/public_html
  </code></pre>
  
  <p>The desired url would look like this:</p>
  
  <pre><code>https://www.exampledomain.com
  </code></pre>
  
  <p>There are two parts to this questions:</p>
  
  <ol>
  <li>Should the htaccess file be in the root or the public_html folder?</li>
  <li>How do I prevent the rewrite rule adding public_html?</li>
  </ol>
  
  <p>Any help would be greatly appreciated and if you would like further information or feel something is unclear please let me know.</p>