====== Apache mod_rewrite ====== * [[Apache]] * [[http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html|mod_rewrite]] * [[http://httpd.apache.org/docs/2.2/rewrite/intro.html|mod_rewrite intro]] * [[http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html|mod_rewrite Variables Cheatsheet]] * [[http://www.cheatography.com/davechild/cheat-sheets/mod-rewrite/|mod_rewrite Cheat Sheet]] All examples need this code: RewriteEngine On Rewrite conditions are cumulative, and will redirect when a ''RewriteRule'' is given. 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 ''server-status'' or ''server-info'' == RewriteCond %{REQUEST_URI} !^/server-(status|info)/?$ == Add a new environment variable == You can access this in PHP through the $_SERVER array. RewriteCond %{REQUEST_URI} steve\.php$ RewriteRule . - [E=VARIABLE_NAME:variable_value,L]