redirect pages to function