From 430aadce59b536d533be35d333eebfe579a94d16 Mon Sep 17 00:00:00 2001
From: Ken Coar
RewriteEngine on -RewriteMap users-to-hosts txt:/path/to/map.users-to-hosts -RewriteRule ^/u/([^/]+)/?(.*) http://${users-to-hosts:$1|server0}/u/$1/$2+RewriteMap users-to-hosts "txt:/path/to/map.users-to-hosts" +RewriteRule "^/u/([^/]+)/?(.*)" "http://${users-to-hosts:$1|server0}/u/$1/$2" @@ -125,8 +125,8 @@ RewriteRule ^/u/([^/]+)/?(.*) http://${users-to-hosts:$1|server0}/u/$1/$2# This example is valid in per-directory context only -RewriteCond %{REQUEST_URI} !-U -RewriteRule ^(.+)\.html$ /regenerate_page.cgi [PT,L] +RewriteCond "%{REQUEST_URI}" !-U +RewriteRule "^(.+)\.html$" "/regenerate_page.cgi" [PT,L]
The -U
operator determines whether the test string
@@ -165,8 +165,8 @@ RewriteRule ^(.+)\.html$ /regenerate_page.cgi [PT,L]
to accomplish this.
RewriteEngine on -RewriteMap lb rnd:/path/to/serverlist.txt -RewriteRule ^/(.*) http://${lb:servers}/$1 [P,L]+RewriteMap lb "rnd:/path/to/serverlist.txt" +RewriteRule "^/(.*)" "http://${lb:servers}/$1" [P,L]
serverlist.txt
will contain a list of the servers:
RewriteEngine on -RewriteRule ^/~(([a-z])[a-z0-9]+)(.*) /home/$2/$1/public_html$3+RewriteRule "^/~(([a-z])[a-z0-9]+)(.*)" "/home/$2/$1/public_html$3" @@ -274,10 +274,10 @@ RewriteRule ^/~(([a-z])[a-z0-9]+)(.*) /home/$2
RewriteEngine on -RewriteCond %{TIME_HOUR}%{TIME_MIN} >0700 -RewriteCond %{TIME_HOUR}%{TIME_MIN} <1900 -RewriteRule ^foo\.html$ foo.day.html [L] -RewriteRule ^foo\.html$ foo.night.html+RewriteCond "%{TIME_HOUR}%{TIME_MIN}" >0700 +RewriteCond "%{TIME_HOUR}%{TIME_MIN}" <1900 +RewriteRule "^foo\.html$" "foo.day.html" [L] +RewriteRule "^foo\.html$" "foo.night.html"
This provides the content of foo.day.html
@@ -318,13 +318,13 @@ RewriteRule ^foo\.html$ foo.night.html
Use the [E] flag to set an environment variable.
RewriteEngine on -RewriteRule ^/horse/(.*) /pony/$1 [E=rewritten:1]+RewriteRule "^/horse/(.*)" "/pony/$1" [E=rewritten:1]
Later in your ruleset you might check for this environment variable using a RewriteCond:
-RewriteCond %{ENV:rewritten} =1+
RewriteCond "%{ENV:rewritten}" =1
Note that environment variables do not survive an external -- cgit v1.2.3