The effect you want to achieve is called url-rewriting.
This is ususally something your server does via configuration and thus differs depending on your server (e.g. apache2, nginx, tomcat etc.)
Please refer this Article as a startingpoint: https://en.wikipedia.org/wiki/Rewrite_engine