On 5 October 2012 17:57, Chris <[email protected]> wrote:
> 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.
Something is going amiss if that is what you are seeing. Not easy to
tell from just what you provided.
See potential workaround below.
> 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]
Try:
RewriteRule ^(.*)$ http://www.something.com%{REQUEST_URI} [L,R=301]
> WSGIDaemonProcess web2py processes=5 threads=1 user=apache group=apache
> display-name=wsgi_web2py
You do not need the options:
user=apache group=apache
as the Apache user would be the default.
> WSGIProcessGroup web2py
> WSGIScriptAlias / /opt/web-apps/web2py/wsgihandler.py
Graham
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
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.