The scenario is the need to rewrite a request for dummy.example.com to 
another directory. The reasoning behind this is a quirk in our current 
set up so we can map algorithmically map and it would involve too many 
rewrite rules to handle manually. The problem is that this seems to be 
working to the point of modifying the filename, but apache returns 403 
to the browser and logs

(2)No such file or directory: Can't open directory for index: 
/var/www/example.com/dummy/

or some other error even though index.rhtml and index.html exist. As 
far as I can tell it could be either a problem with the Apache::SiteMap 
class below or the apache config. Also on that matter does anyone know 
how I can get the module triggered on the host instead of the 
directory?

I've attempted to look at http://modrubby.net/ but it seems to be down 
so I've been using the google cache. Anyone care to give me a few 
pointers, here's extracts from the relevant files,

apache config:

<IfModule mod_ruby.c>
   RubyRequire sitemap
   <Directory /var/www/example.com/>
    SetHandler ruby-object
    RubyHandler Apache::SiteMap.instance
    Options +Indexes
    DirectoryIndex index.rhtml index.html index.htm index.html.var
   </Directory>

   # other stuff
</IfModule>

sitemap.rb contains, with debugging code removed,

require "singleton"
module Apache
   class SiteMap
     include Singleton
     @@host2dir = {'dummy.example.com' => 'dummy/'}

     def handler(r)
       r.content_type = 'text/html'
       r.send_http_header
       exit(Apache::OK) if r.header_only?

       document_root = r.server.document_root
       (document_root[-1] != "/") && document_root += "/"

       if @@host2dir.has_key?(r.headers_in['Host'])
         newdocroot = document_root + @@host2dir[r.headers_in['Host']]
         filename = r.filename.sub("#{document_root}", newdocroot)
         puts "sub: #{document_root} #{newdocroot} #{filename}<br>"
       end
       r.filename = filename
       return Apache::DECLINED
     end
   end
end