Reorganize page url related code.