You can use a custom 404 page.
Lets say the you send a visitor to
http://your_url/xyz
<%
str_query = Request.ServerVariables("QUERY_STRING")
str_search_string = replace(str_query,"404;" & your_url & ":80/","")
folder_array = split(str_search_string,"/")
no_arrays = ubound(folder_array)
%>
Then folder_array(0) = "xyz"
You send a visitor to
http://your_url/xyz/abc
Then folder_array(0) = "xyz"
Then folder_array(1) = "abc"
Obviously you have to put some checking in place that makes sure the
folders are correct, otherwise send a 404 header, so if all the folders
have a similar format, say id_###### and the result doesn't contain
"id_" you return a 404 error