Just a brief sketch, in JavaScript:-
<script type="text/javascript">
<!--
var fragmap = {};
fragmap['#code'] = './code/';
fragmap['#faq'] = '/faq/';
if (location.hash) {
if (location.hash in fragmap) {
location = fragmap[location.hash];
}
}
// -->
</script>
Obvious drawback: only works in JavaScript enabled browsers. In fact, even then you have to refresh the page (in Phoenix 0.5, at least) to get it to work.