Apache url rewrite notes, apacherewrite
What is mod_rewrite?
Mod_rewrite is a module of apache that allows the server to modify the request url. The inbound url will be compared with a series of rule. These rule contains a regular expression to detect each particular pattern. If the pattern is detected in the url and the appropriate Preset conditions are met, the pattern name will be replaced by a preset string or behavior.
This process continues until there are no unprocessed rules or the process is explicitly stopped.
This can be summarized by three points:
- Rule Set with a series of sequential processing
- If a rule is matched, the system checks whether the corresponding conditions of the rule are met.
- If all processing results are go, a replacement or other action will be executed.
Benefits of mod_rewrite
There are some obvious advantages, but some are not very obvious:
Mod_rewrite is widely used to convert ugly and obscure URLs to form "friendly or clean URLs ".
On the other hand, the converted URLs will be friendly to search engines.