I am trying to setup my Django app to run under Apache with modwsgi. I have defined the following virtualhost:
<VirtualHost *>
ServerName www.domain.com
ServerAlias domain.com
WSGIScriptAlias / /home/domain/apache/django.wsgi
<Directory /home/domain/apache>
Order deny,allow
Allow from all
Options -Indexes +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [QSA,L,R=301]
</Directory>
</VirtualHost>
The rewrite rules at the end are there to make www.domain.com the canonical site name. There is something wrong though. When I browse to >http://domain.com, I get redirected to >http://www.domain.com/django.wsgi/. Browsing to >http://www.domain.com works just fine.
Am I missing something in my configuration? Thanks.
Update: I changed the RewriteRule to
RewriteRule ^django.wsgi/(.*)$ domain.com/$1 [L,R=301].
This change fixes the issue. I will appreciate it if someone can elaborate on why the /django.wsgi/ part ends up in the URL. Thanks!