in reply to Re: mod rewrite on mod perl handler skip trans handler phase
in thread mod rewrite on mod perl handler skip trans handler phase

I currently have "Location /" mapped to a Index handler which shows the index page. I was thinking about a check like:
if location isnt mapped in httpd.conf or location doesnt exist on file system redirect to profile
So if someone entered $base_url/$f_id ie: myspace.com/perlmonks

if the httpd.conf doesnt contain "Location /perlmonks" and the file structure doesnt contain the "perlmonks" directory/file redirect to the profile handler.

but not sure how the performance might be. Do you guys think this is an efficient way of doing this?

Checking the file on the file structure would require a stat for each request which can be expensive.

Guess an easier option is to just set up a separate url for profiles. IE: profiles.myspace.com/$f_id

Replies are listed 'Best First'.
Re^3: mod rewrite on mod perl handler skip trans handler phase
by perrin (Chancellor) on Dec 19, 2006 at 21:26 UTC

    Okay, I think i finally understand your problem. You want to only intercept requests that didn't map to anything else. I don't think you can do that in any easy way with mod_rewrite. It would certainly be much easier to use a top-level prefix (like your /u example) or a virtual host (like your profiles.myspace.com example).

    One relatively simple thing you can try is to just map your perl module to the handler for 404 NOT FOUND errors. Then it will only get things that didn't match anything else. That's the easiest route, if you don't want to use the naming tricks.