I would like to use .htaccess files to password protect certain directories of my website, which is running on a Google Compute Engine Debian instance with LAMP installed.

However, GCE appears to ignore .htaccess files.

How do you enable HTTP basic auth so .htaccess files will work on GCE instances?


GCE Instances are linux servers. No more, no less. Just like any other linux server, they need to be configured properly. It's likely that all you need to do is tweak your apache configuration accordingly to get it to respect your .htaccess file.

  • I was looking for the http.conf file to enable .htaccess but couldn't find it. I thought perhaps GCE did not allow access to this file. However, reading the Apache documentation, I realized http.conf has been replaced by apache2.conf. I editted apache2.conf and enabled http basic authentication and my htaccess files work as they should. – charred water Jun 1 '17 at 5:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.