Forum Discussion

Chip_Hudgins_64's avatar
Chip_Hudgins_64
Icon for Nimbostratus rankNimbostratus
Jun 01, 2005

another rewrite question

I am trying to create a data group of rewrites (rather than redirects). What I have is based on post id 2078.

 

 

rewrite

 

set rewrite [findclass [HTTP::uri] $::rewrite_mapping " "]

 

if { ${rewrite} ne "" } {

 

if { $DEBUG } {

 

log local0. "rewriting [HTTP::uri] to ${rewrite}"

 

}

 

 

HTTP::uri ${rewrite}

 

}

 

 

class rewrite_mapping {

 

"/groups/IR/bin /groups/cit/bin"

 

"/search/help/images /images"

 

"/search/help/user_help.html /user_help.html"

 

}

 

 

so that the first column in “rewrite_mapping” will be replaced by what is in the second column. What does not seem to work is the substitution for the rest of the URL.

 

For example:

 

http://foo/search/help/user_help.html does get rewritten to http://foo/user_help.html (last entry)

 

but how do I get

 

http://foo/groups/IR/bin/bar.cgi to be rewritten to http://foo/groups/cit/bin/bar.cgi (first entry)

 

without having to place every file under bin in the mapping file?

 

 

Any help would be greatly appreciated

 

 

Thanks

 

 

Chip