Body: <p>So I raised a previous thread here. </p>
  
  <p><a href="https://craftcms.stackexchange.com/questions/16741/conflict-with-htaccess-htpswd">https://craftcms.stackexchange.com/questions/16741/conflict-with-htaccess-htpswd</a></p>
  
  <p>Basically with the site behind a <code>htpasswd</code> (as it is a staging url) after entering the correct u/p I would get redirected to a 404 which was in fact a 401 error.</p>
  
  <p>After further investigation and some support from CPanel. I understand that there is a requirement to add the following line to the <code>htaccess</code> file before the rewrites (in the Craft rewrites).</p>
  
  <p><code>RewriteCond %{LA-U:REMOTE_USER} !^$</code></p>
  
  <p>So the Craft rewrites now look like this;</p>
  
  <pre><code># Send would-be 404 requests to Craft
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{LA-U:REMOTE_USER} !^$
  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
  RewriteRule (.+) index.php?p=$1 [QSA,L]
  </code></pre>
  
  <p>This only became an issue this week. Previously it all worked fine before this. The above solution does seem to be a fix. But I'm a little stumped as to why this is required now and was working ok before. Has anyone else come up against this?</p>
  
  <p>CPanel seemed to think it wouldn't have ever worked without this line. But it did and I am sure others have it working without a need to add this.</p>
  
  <p>The difficult thing is that I am unable to get a clear reason as to why this is now required and what has changed to enforce this. Over the past week a few things have occurred and so I cannot pinpoint. These updates to the server have included;</p>
  
  <ul>
  <li>Updating Apache 2.2 to 2.4</li>
  <li>Upgrading to easyapache 4 from easyapache 3</li>
  <li>Updating Craft after the latest releases.</li>
  </ul>
  
  <p>If anyone can shed any additional light on this it would be useful. Also if anyone can confirm if they also need to include the <code>RewriteCond %{LA-U:REMOTE_USER} !^$</code> into their <code>htaccess</code>.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-09-12T00:48:32.460Z
Comments.Text: My guess would be the Apache, upgrade, but I don't know for sure.  Seems like we can delete https://craftcms.stackexchange.com/questions/16741/conflict-with-htaccess-htpswd now, since this is a follow-up with more information, no?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-09-12T20:40:28.207Z
Comments.Text: Yes please delete. Any ideas where it what I might need to look at? It's driving me mad this one. Can't find anything similar or any real difference after the upgrade.
Comments.UserDisplayName: Terry Upton
Tags: <htaccess><password><apache>
Title: htpasswd issues with Craft
ThreadText: # htpasswd issues with Craft
  
  (Asked by: username_0 on 2016-09-11)
  
  So I raised a previous thread here.
  
  <https://craftcms.stackexchange.com/questions/16741/conflict-with-htaccess-htpswd>
  
  Basically with the site behind a `htpasswd` (as it is a staging url) after entering the correct u/p I would get redirected to a 404 which was in fact a 401 error.
  
  After further investigation and some support from CPanel. I understand that there is a requirement to add the following line to the `htaccess` file before the rewrites (in the Craft rewrites).
  
  `RewriteCond %{LA-U:REMOTE_USER} !^$`
  
  So the Craft rewrites now look like this;
  
  ```
  # Send would-be 404 requests to Craft
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{LA-U:REMOTE_USER} !^$
  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
  RewriteRule (.+) index.php?p=$1 [QSA,L]
  
  ```
  
  This only became an issue this week. Previously it all worked fine before this. The above solution does seem to be a fix. But I'm a little stumped as to why this is required now and was working ok before. Has anyone else come up against this?
  
  CPanel seemed to think it wouldn't have ever worked without this line. But it did and I am sure others have it working without a need to add this.
  
  The difficult thing is that I am unable to get a clear reason as to why this is now required and what has changed to enforce this. Over the past week a few things have occurred and so I cannot pinpoint. These updates to the server have included;
  
  * Updating Apache 2.2 to 2.4
  * Upgrading to easyapache 4 from easyapache 3
  * Updating Craft after the latest releases.
  
  If anyone can shed any additional light on this it would be useful. Also if anyone can confirm if they also need to include the `RewriteCond %{LA-U:REMOTE_USER} !^$` into their `htaccess`.
  
  **Tags:** htaccess, password, apache
  
  > **Comments:**
  > **username_1**: My guess would be the Apache, upgrade, but I don't know for sure.  Seems like we can delete https://craftcms.stackexchange.com/questions/16741/conflict-with-htaccess-htpswd now, since this is a follow-up with more information, no?  
  > **username_0**: Yes please delete. Any ideas where it what I might need to look at? It's driving me mad this one. Can't find anything similar or any real difference after the upgrade.  
  
  ---
  
  ## 0 answers
  
  