News for hackers. Stuff that matters.
Re:URL Rewriting for Beginners by snorkel on Monday August 04, 2008 @12:11PM (#266399)
Bah, mod_rewrite is for sissies! Parse the url in your handler code!

   <Location /dostuff>
     SetHandler mod_python
     PythonHandler DoStuff
   </Location>
Any request starting with /dostuff gets passed to DoStuff handler and you can parse the url pieces in the handler itself:

   from mod_python import apache

   def handler(req):
     req.content_type = 'text/plain'
     print >> req, 'uri = %s' % req.uri
     print >> req, 'filename = %s' % req.filename
     print >> req, 'path_info = %s' % req.path_info
     return apache.OK
Re:URL Rewriting for Beginners by sant0sk1 on Monday August 04, 2008 @09:43PM (#267033)
or like this:

    require 'rubygems'
    require 'sinatra'

    get '/:name' do
       "Your name is #{param[:name]}"
    end