support redirect by using correct document URI
Merge pull request #100 from shawnzhu/redirect

support redirect by using correct document URI