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.  I'm using Apache 2.2.15 + mod_wsgi 3.3.

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

Thanks for your help

<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

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/modwsgi/-/OKnJnptED2UJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to