It looks like this can be achieved by modifying the variable undo-tree-history-directory-alist, but I can't figure out how. I tried a number of lines, the last of which is
(setq undo-tree-history-directory-alist ("." ! "~/.emacs.d/undo"))
But this returns errors.