title: Magento - URL rewriting or redirection issue
body: <p>I am running a site in <code>Magento</code> version 1.9.1.0 which is <code>SSL</code> enabled. When I open that site's admin panel on a browser either after refresh the cache of browser or in private mode then first time it shows site's homepage rather than admin login page i.e. <code>sitename.com/admin</code> URL redirects to <code>https://sitename.com</code> URL automatically on first time.</p>
  <p>Same issue happened when I try to access inner page of the site directly first time.</p>
  <p>After this when I enter again URL in browser's address bar as <code>sitename.com/admin</code> then it open admin login page which is good on next time(seems cache works).</p>
  <p>I am using <code>Login and Pay with Amazon</code> extension in my Magento site. So when I go for login with Amazon then after inject the credentials it shows me error as follows:</p>
  <blockquote>
  <p><strong>No data received. Unable to load the webpage because the server sent no data on chrome.</strong></p>
  <p><strong>secure connection failed on firefox</strong></p>
  </blockquote>
  <p>I am using Base URLs (unsecured and secured as <a href="https://sitename.com" rel="noreferrer">https://sitename.com</a>) in admin panel under <code>System &gt; configuration &gt; General &gt; web</code> which seems to be right? I have doubt in my <code>.htaccess</code> file this part of code. I have used the following code in my <code>.htaccess</code> file:</p>
  <pre><code>############################################
  ## workaround for HTTP authorization
  ## in CGI environment
  
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  
  
  RewriteCond %{SERVER_PORT} 80
  RewriteRule ^(.*)$ https://www.sitename.com/$1 [R,L]
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  
  ############################################
  ## TRACE and TRACK HTTP methods disabled to prevent XSS attacks
  
  RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
  RewriteRule .* - [L,R=405]
  
  ############################################
  ## redirect for mobile user agents
  
  #RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
  #RewriteCond %{HTTP_USER_AGENT}    &quot;android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile&quot; [NC]
  #RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]
  </code></pre>
  <p>My Requirements are:</p>
  <ul>
  <li><p>Site always open with <code>https</code> which is working fine.</p>
  </li>
  <li><p>When user access the site either with <code>www</code> or without <code>www</code> site always open with <code>https://sitename.com</code>. and avoid <code>index.php</code> in the URL which is working fine.</p>
  </li>
  <li><p>When I access admin panel at any time either first or next to first, it should display admin login screen.</p>
  </li>
  <li><p>Remove error which is occurring after login with Amazon.</p>
  </li>
  </ul>
  <p>Kindly please help me to resolve this issue. If any other code required please let me know.</p>