mod_rewrite can be used to manipulate URLs. It is compiled into the base Apache Web Server. This module provides the ability to manipulate URLs prior to determining the appropriate file or handing off to a script. It can help you, if you want to offer different URLs for the same file. This is most commonly used when a visitor goes to a certain web address, but the server returns a different page. This module uses a rule-based rewriting engine to rewrite requested URLs on the fly. It supports an unlimited number of rules to provide a really flexible and powerful URL manipulation mechanism. It can hide sensitive information, such as query strings, from URL requests. This can potentially enhance website safety.
In this tutorial, we will explain how to enable
mod_rewrite and demonstrate some common ways to use it in Apache on CentOS 7.