mod_rewrite

Apache mod_rewrite: RewriteCond and RewriteRule

This Apache documentation for mod_rewrite are clear and comprehensive. This page does not intend to replace nor replicate the official documentation. However, some for of example-based tutorial may be helpful for some beginners to get them started. The examples below need to be completed and better annotated.

Let's start with the easiest example:

Let's say we want to redirect "home" to "/".

<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteRule home / [redirect,last] # This example will not give the intended result!!
</IfModule>

Syndicate content