add the following function.
- redirect to top page if user visited undefined page