SiteKickr Web Development

Mod Rewrite w/ HTTP Authentication

Putting a site behind HTTP Authentication is a pretty simple task, but when your site is being served by another application server – let's say Zope (Plone) for example, the method isn't as obvious.

The example VirtualHost stanza below should help:

<VirtualHost *:80>
  ServerName www.mysite.com
  <Location />
  AuthType Basic
  AuthName "Login Here"
  AuthUserFile /var/www/html/passwords   # the password file created with htpasswd
  Require user some_user_name
  </Location>
  RewriteEngine On
  RewriteRule ^/(.*) http://127.0.0.1:8080/VirtualHostBase/http/%{HTTP_HOST}:80/my-plone-site.com/VirtualHostRoot/$1 [L,P]
</VirtualHost>