views:

194

answers:

0

I have a Media Temple DV server hosting dev.example.com with django mounted at /. There is a legacy directory in my httpsdocs I need to continue to serve at /legacy. But for this directory I need to redirect anyone coming over http over to https, then prompt for http basic auth.

In the virtual host conf, I'm pointing the root to a django application:

WSGIScriptAlias / /var/django-projects/myproject/apache/django.wsgi

<Directory /var/django-projects/myproject/apache>
   Order allow,deny
   Allow from all
</Directory>

Then I alias the legacy directory. Note that both ...httpdocs/legacy and ...httpsdocs/legacy exist on the filesystem. ...httpdocs/legacy contains an .htaccess file. ...httpsdocs/legacy contains the documents I'm trying to serve.

Alias /legacy/ /var/www/vhosts/example.com/subdomains/dev/httpdocs/legacy/
<Directory /var/www/vhosts/example.com/subdomains/dev/httpdocs>
    Order deny,allow
    Allow from all
    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://dev.example.com/$1 [R,L]
</Directory>

This works. It isn't served by django, and the url redirects to https. However, it serves httpdocs/legacy instead of httpsdocs/legacy (where I have an .htaccess that prompts for auth.)

Any idea of how I can manage this?