Support redirect and configurable dir