On Feb 25, 9:40 pm, Jani Tiainen <[EMAIL PROTECTED]> wrote:
> I've multiproject setup using apache andmod_python.
>
> Everything works well except when user enters non-existing project name,
> likehttp://www.example.com/trac/foobar
>
> End user only gets "Environment not found", that is not very
> descriptive. Is there way to point to another URL or set one enviroment
> as a default so user would be always redirected to something sane?
>
> Maybe some mod_rewrite stuff?

One of the mod_wsgi examples for Trac uses a bit of mod_rewrite to
verify that Trac instances exists.

  WSGIDaemonProcess sites processes=3 threads=25 maximum-requests=1000

  RewriteEngine On

  RewriteCond %{REQUEST_URI} ^/trac/([^/]+)
  RewriteCond /usr/local/trac/sites/%1/conf/trac.ini !-f
  RewriteRule . - [F]

  RewriteCond %{REQUEST_URI} ^/trac/([^/]+)
  RewriteRule . - [E=trac.env_path:/usr/local/trac/sites/%1]

  WSGIScriptAliasMatch ^/trac/([^/]+) /usr/local/trac/apache/trac.wsgi

  <Directory /usr/local/trac/apache>
  WSGIProcessGroup sites
  WSGIApplicationGroup %{GLOBAL}
  Order deny,allow
  Allow from all
  </Directory>

As written this will raise a forbidden message if non existent site is
accessed. You could either replace the 'RewriteRule . - [F]' to do
something different, or use Apache ErrorDocument directive to point at
a custom error page.

The particular rewrite rules could also be made to work if using
mod_python.

Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" 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/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to