sportteens.ru
Guide to Apache mod_rewrite - Apache HTTP Server Version 2.4
Modules | Directives | FAQ | Glossary | Sitemap | Report a bug
Apache HTTP Server Version 2.4
Apache > HTTP Server > Documentation > Version 2.4Guide to Apache mod_rewrite
Available Languages: en |
fr |
tr |
zh-cn
The great thing about mod_rewrite is it gives you all the
configurability and flexibility of Sendmail. The downside to
mod_rewrite is that it gives you all the configurability and
flexibility of Sendmail.
-- Brian Behlendorf
Despite the tons of examples and docs, mod_rewrite is voodoo.
Damned cool voodoo, but still voodoo.
-- Brian Moore
mod_rewrite provides a way to modify incoming
URL requests, dynamically, based on regular
expression rules. This allows you to map arbitrary URLs onto
your internal URL structure in any way you like.
This guide supplements the
reference manual with annotated examples, conceptual
explanations, and practical advice. It is organized as follows:
Introduction
Core concepts: regular expression syntax, RewriteRule and
RewriteCond basics, and how mod_rewrite fits into the request
processing lifecycle.
Per-directory Rewrites
The key differences between using rewrite rules in server
configuration versus per-directory
context, including path stripping, RewriteBase, and the looping behavior
of the [L] flag.
RewriteRule Flags
A complete reference for all flags that can modify the behavior of
a RewriteRule, with examples for each.
Using RewriteMap
How to use external lookup sources — text files, DBM databases,
SQL queries, and internal functions — to drive your rewrite
rules.
Redirection and Remapping
Recipes for common tasks: HTTPS redirection, canonical hostnames,
trailing slash normalization, front-controller routing, and more.
Dynamic Virtual Hosts
Using mod_rewrite to dynamically map hostnames to document roots
without individual VirtualHost blocks.
When NOT to use mod_rewrite
Many common tasks are better accomplished with simpler directives.
This document shows the alternatives and when to prefer them.
Technical Details
How mod_rewrite hooks into the Apache request processing phases,
and the order in which rules and conditions are evaluated.
See alsomod_rewrite Reference DocumentationMapping URLs to the Filesystemmod_rewrite
wikiGlossary
Available Languages: en |
fr |
tr |
zh-cn
Copyright 2026 The Apache Software Foundation.Licensed under the Apache License, Version 2.0.
Modules | Directives | FAQ | Glossary | Sitemap | Report a bug
page_1 | page_2 | page_3 | page_4 | page_5 |