Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

I would like it so that a hit to turns up the django site (as is currently the case, configured so in the conf file) while a hit to 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/] in the [/] was all I needed.

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

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

share|improve this question
up vote 1 down vote accepted

Best way to do this is with two virtual hosts, one for, and one for

<VirtualHost *:80>
    DocumentRoot /path/to/django-site

<VirtualHost *:80>
    DocumentRoot /path/to/httpdocs

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(.*)$$1 [NC,P,L]
share|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. – Cody Django Jul 22 '09 at 21:08

You can do the following in your vhost.conf file:

ServerName  a server name
ServerAlias a server alias
DocumentRoot /path-to-django-web/root
<Directory  /path-to-django-web/root >
    Options FollowSymLinks Indexes
    DirectoryIndex index.php index.html
    AllowOverride All
    Order allow,deny
    Allow from all

       <IfModule mod_rewrite.c>
               RewriteEngine On
               RewriteBase /

               #Do your rewrite magic here
       <IfModule !mod_rewrite.c>
               ErrorDocument 404 /index.php

That is the way MT DV's vhost loads custom vhost configuration, it does not need the VirtualHost tags since they are already loaded by the default VH configuration.

Remember to restart your server and to reconfigure your domain, check what are the options available on your server manager, in the terminal type the following:

$ /usr/local/psa/admin/sbin/websrvmng --help

Usually you will have to reconfigure vhost

After that restart apache

$ /etc/init.d/httpd graceful

That should do it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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