I have a website built using Django on Dreamhost deployed successfully with Passenger and Apache. I have a set of static HTML pages that is being served in a remapped sub-directory called /demo/
. By adding a .htaccess
file to the /demo/
directory with this line:
PassengerEnabled off
I was able to bypass Django and serve the static pages in the /demo/
directory. I would like to add password protection to the /demo/
pages without editing the Django python files, but was unable to do so by adding the following lines to the .htaccess
file (both above and below the PassengerEnabled off
line:
AuthUserFile /public/demo/.htpasswd
AuthGroupFile /dev/null
AuthName "Private Demo Area"
AuthType Basic
require valid-user
I am not forced to use the .htaccess
file approach and was wondering how do I configure the static file directory to not be processed by Django but also be password protected? Thanks!
I found a solution which involved creating a subdomain instead of trying to serve the static files through Django and Passenger through a remapped sub-directory. Here is what I did:
Added the .htaccess file to the root directory of the subdomain:
AuthUserFile /public/demo/.htpasswd AuthGroupFile /dev/null AuthName "Private Demo Area" AuthType Basic require valid-user
That did the trick, but the domain for my demo is now demo.domain.com
instead of domain.com/demo/
. I am ok with this trade off and this was the only solution I could find on dreamhost shared hosting.