up vote 2 down vote favorite
share [g+] share [fb]

I've made a django site for a magazine, and it's found in mag.org/django-site. the old site is still at mag.org/httpdocs (hosted by mediatemple).

I would like it so that a hit to www.mag.org turns up the django site (as is currently the case, configured so in the conf file) while a hit to archive.mag.org serves the old site from httpdocs, that is, it's served by apache and not mod_python.

Is this possible to do through mod-rewrite, or mod-alias?

  • hosted by mediatemple dv. httpd.conf is rewritten by plesk; httpd.conf access is limited to a single vhost.conf for each domain/subdomain.

  • a simple [DocumentRoot /var/www/vhosts/mag.org/httpdocs] in the [/mag.org/subdomains/archive/conf/vhost.conf] was all I needed.

  • now mag.org points to the django site being served by mod-python, while archive.mag.org points to the httpdocs folder, served by apache.

(I initially posted this at stack-overflow, but I think it's more suited for serverfault.)

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

Best way to do this is with two virtual hosts, one for www.mag.org, and one for archive.mag.org

<VirtualHost *:80>
    ServerName www.mag.org
    DocumentRoot /path/to/django-site
</VirtualHost>

<VirtualHost *:80>
    ServerName archive.mag.org
    DocumentRoot /path/to/httpdocs
</VirtualHost>

This answer on virtualhosts and aliases may be helpful to you.


Edit: It is possible to do this with mod_rewrite, if you really need to. If you have mod_proxy you can also proxy the re-write so that the address doesn't change in the user address bar.

DocumentRoot  /path/to/django-site
Alias         /archive/                    "/path/to/httpdocs/"
RewriteRule   ^archive\.mag\.org(.*)$      http://www.mag.org/archive$1 [NC,P,L]
link|improve this answer
thanks for the quick reply, but I don't think this will work at mediatemple. I'm using their dv container, and all domains contain their own vhost directory and vhost.conf file. I'll try it, though. – user12158 Jul 22 '09 at 21:08
feedback

Your Answer

 
or
required, but never shown

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