[mod_python] How can I have sensible URLs?

Martin Pool mbp at samba.org
Wed Sep 4 11:42:35 EST 2002


On  3 Sep 2002, Peter Bittner <peter.bittner at gmx.net> wrote:
> Hi there!
> 
> I have a little bit of understand problem of how the architecture of a
> mod_python web application (say web site, if you want) should be.
> 
> I would like to have the URLs as if the mod_python scripts were simply some
> kind of "special HTML documents", comparable to PHP scripts.
> 
> For example, I have written a script named "index.py" which is located on my
> document root. So I would expect "http://www.mydomain.com/index.py" to
> execute my script (I have set up my Apache so that I can omit the filename, too).
> But it doesn't. When I remove the ".py" at the end there is no change to this
> too.
> 
> So what I have to do is to execute "http://www.mydomain.com/index/method",
> provided a method called "method" in my script. This way it works. - But is
> there a way to have "HTML-like" or "PHP-like" behavior? Or how do I have to
> organize my scripts so that I can have my whole website written in mod_python
> and can run it with "http://www.mydomain.com" alone?

Have a look at the mod_rewrite documentation.  Something like

  RewriteMatch /index/(.*) /python/index.py/$1

-- 
Martin 



More information about the Mod_python mailing list