here is a quick tip about password-protected directories conflicting with phpbb's, Drupal's and with Wordpress' front controller, resulting in "Route not found for GET / ..." or "No route found for GET / ..."
if you create a directory using htaccess/htpasswd access protection besides or within an app using a front controller, you won't be able to access the password-protected directory or folder, but you will get an error message from phpbb, Drupal or Wordpress along the lines of "No route found for GET /<your directory>"
after spending hours toiling with htaccess, apache directives, etc. I finally stumbled upon the answer: Apache's prompt for a password is a request with 401 status, so it's caught by the front controller and redirected to whatever app depends on it.
to avoid this, add the following line to the htaccess file within the protected directory:
ErrorDocument 401 "Authorisation Required"
So, if your htaccess file looked like this:
AuthType Basic
AuthName "Members Only"
AuthUserFile /var/www/blabla/web/protected/.htpasswd
require valid-user
DirectoryIndex index.html index.php
Header set Content-Security-Policy "default-src * 'self' 'unsafe-inline' 'unsafe-eval' data:;"
It should rather look like this:
AuthType Basic
AuthName "Members Only"
AuthUserFile /var/www/blabla/web/protected/.htpasswd
require valid-user
DirectoryIndex index.html index.php
Header set Content-Security-Policy "default-src * 'self' 'unsafe-inline' 'unsafe-eval' data:;"
ErrorDocument 401 "Authorisation Required"
it should work properly after that.
- Log in to post comments
Comments