code: func redirectPath(u *url.URL) string {
  	// Redirect old gitweb URLs to gerrit. Example:
  	// /code/?p=camlistore.git;a=commit;h=b0d2a8f0e5f27bbfc025a96ec3c7896b42d198ed
  	if strings.HasPrefix(u.Path, "/code/") {
  		m := gitwebCommit.FindStringSubmatch(u.RawQuery)
  		if len(m) == 2 {
  			return gerritURLPrefix + m[1]
  		}
  	}
  
  	if strings.HasPrefix(u.Path, "/gw/") {
  		path := strings.TrimPrefix(u.Path, "/gw/")
  		if commitHash.MatchString(path) {
  			// Assume it's a commit
  			return gerritURLPrefix + path
  		}
  		return gerritURLPrefix + "master/" + path
  	}
  
  	if strings.HasPrefix(u.Path, "/docs/") {
  		return "/doc/" + strings.TrimPrefix(u.Path, "/docs/")
  	}
  
  	// strip directory index files
  	for _, x := range indexFiles {
  		if strings.HasSuffix(u.Path, "/"+x) {
  			return strings.TrimSuffix(u.Path, x)
  		}
  	}
  
  	// strip common file extensions
  	for _, x := range fileExtensions {
  		if strings.HasSuffix(u.Path, x) {
  			return strings.TrimSuffix(u.Path, x)
  		}
  	}
  
  	return ""
  }
docs: // empty return value means don't redirect.