no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | apache_mod_rewrite [2014/05/09 18:16] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Apache mod_rewrite ====== | ||
+ | * [[Apache]] | ||
+ | |||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | All examples need this code: | ||
+ | |||
+ | < | ||
+ | RewriteEngine On | ||
+ | </ | ||
+ | |||
+ | Rewrite conditions are cumulative, and will redirect when a '' | ||
+ | |||
+ | Rewrite conditions also execute in listed order, so if the first one matches it will redirect, and the second one won't be read. | ||
+ | |||
+ | You can use perl regular expressions. | ||
+ | |||
+ | === Examples === | ||
+ | |||
+ | == Match URLs that are not '' | ||
+ | |||
+ | < | ||
+ | RewriteCond %{REQUEST_URI} !^/ | ||
+ | </ | ||
+ | |||
+ | == Add a new environment variable == | ||
+ | |||
+ | You can access this in PHP through the $_SERVER array. | ||
+ | |||
+ | < | ||
+ | RewriteCond %{REQUEST_URI} steve\.php$ | ||
+ | RewriteRule . - [E=VARIABLE_NAME: | ||
+ | </ |