I have an Apache-WSGI-web2py configuration that is working well. Now I would like to add the behavior that requests on the bare domain (something.com/what/ever) is rewritten to use www (www.something.com/what/ever). In a generic Apache setup, this is easy using a rewrite condition + rewrite rule.
When I try this with mod_wsgi, it appears the request is first mapped to /path/to/web2py/wsgihandler.py/what/ever before the rewrite rule is applied. mod_rewrite operates on this, and outputs http://www.something.com/wsgihandler.py/what/ever (error). This is visible in the mod_rewrite log. Does anyone have a way to rewrite non-www to www URLs while using mod_wsgi? Here is the relevant excerpt from my Apache default.conf <VirtualHost *:80> ServerName www.something.com ## ## rewrite bare domain URLs to canonical/www format RewriteEngine on RewriteCond %{HTTP_HOST} ^something\.com$ [NC] RewriteRule ^(.*)$ http://www.something.com/$1 [L,R=301] WSGIDaemonProcess web2py processes=5 threads=1 user=apache group=apache display-name=wsgi_web2py WSGIProcessGroup web2py WSGIScriptAlias / /opt/web-apps/web2py/wsgihandler.py Thanks all --