On Thursday 20 July 2006 11:52 am, Michael Peters wrote:
> > So urls for my website look like this:
> > http://www.petnuch.com/app/module/runmode. However, I would like them
> > do just look like this: http://www.petnuch.com/module/runmode. I can do
> > this by putting the Dispatch stuff under the '/' location, however, them
> > I have the problem of my css files and images (which are actually under
> > '/') not being served. I figure there is some mod_rewrite magick that
> > does this but I am not really versed with it.
I've been using the following, which works for me:
---------- snip ----------
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /app$1 [L,PT]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ /app$1 [L,PT]
<Location /app>
SetHandler perl-script
PerlHandler CGI::Dispatch
...
</Location>
---------- snip ----------
The first set of rules check to make sure that we don't have an actual
file/directory on disk to serve up and pass everything else through
to "/app/....".
The second set of rules catch requests for "/", which actually does exist on
disk, but that I still want to have sent through to the dispatcher.
What's most important in the mod_rewrite rules above is the "PT" (pass-thru);
this tells Apache that it should pass the request through as a sub-request
rather than actually trying to look it up as a file in the filesystem.
--
Graham TerMarsch
Howling Frog Internet Development, Inc.
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]