The docs for WSGIScriptAliasMatch https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIScriptAliasMatch are openly scary. Is there a way to say "Everything in this directory goes through this WSGI script, unless the URL begins with a tilde, in which case process it the old way"?

My site file is currently like this:

<VirtualHost *:80>
    ... other directives ...
    AliasMatch ^/1/~(.*)$ /var/www/rosuav.com/1/~$1
    WSGIScriptAlias /1 /var/www/rosuav.com/1/1.wsgi

In theory, it ought to be possible to have the WSGIScriptAlias directive specifically ignore URLs beginning with tildes, but I don't want to break stuff :)

  • To clarify, part of the key here is that I don't want to have to repeat the directory name everywhere. Especially if I end up with multiple alias negations, each having to repeat /var/www/rosuav.com. – rosuav Feb 7 '15 at 23:27

Have a look at the tail end of the section:

It explains how you can have access against a directory fallback to using an overlaying WSGI application if there is no static file mapping to the URL.

Stepping back though, can you explain the original problem rather than the solution you believe you need?

Is the issue that you are having problems with the precedence order between ~username directories supported by mod_userdir and WSGIScriptAlias from mod_wsgi?

This is a known issue but not had a recent complaint about it, so hasn't been fixed.


Also read:

This explains how to mix PHP and Python sites together.

  • The problem I'm looking at is this: I used to have a directory with a handful of PHP scripts, and a number of symlinks to other directories. I rewrote the PHP scripts' functionality in Python, using Flask and WSGI, but I want the symlinks to still be functional - that is, going to http://.../~whatever/something.php should still execute the PHP script, even though http://.../somepage will now be executed by Python. – rosuav Feb 11 '15 at 12:06
  • I'm not using mod_userdir, btw; they're not user names per se, they're just symlinks that happen to begin with tildes. (They look like user names to the outside world, but aren't implemented that way.) The current system works, but doesn't seem elegant. – rosuav Feb 11 '15 at 12:07
  • The recipe using AddHandler/RewriteRule in that doc should be able to be used then. Also read blog post have added link for above. – Graham Dumpleton Feb 11 '15 at 23:31

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.