Clean up some of the Apache config mod_rewrite rules
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 30 Nov 2010 05:12:13 +0000 (05:12 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 30 Nov 2010 05:12:13 +0000 (05:12 +0000)
Thomas Berezansky suggested some improvements to the mod_rewrite
rules in eg_vhost.conf on the -devel mailing list; this is a stab
at correcting the most egregious problems.

Tested with Zotero and unAPI still works; tested with the staff
client and language-switching still works, as do the Conify and
Vandelay interfaces. Seems reasonably good.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@18868 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/apache/eg_vhost.conf

index 5b81f7a..89ae416 100644 (file)
@@ -59,17 +59,14 @@ RewriteRule ^/opac/extras/ac/jacket/(small|medium|large)/$ \
 # ----------------------------------------------------------------------------------
 # Add the row ID (RID) and date so we can make unAPI happy
 # ----------------------------------------------------------------------------------
-RewriteEngine ON
 RewriteCond %{QUERY_STRING} (^r|&r)=(\d+)
-RewriteRule - - [E=OILS_OPAC_RID:%2]
-RewriteRule - - [E=OILS_TIME_YEAR:%{TIME_YEAR}] [L]
+RewriteRule . - [E=OILS_OPAC_RID:%2,E=OILS_TIME_YEAR:%{TIME_YEAR}]
 
 # ----------------------------------------------------------------------------------
 # Pull the locale from the URL
 # ----------------------------------------------------------------------------------
-RewriteEngine ON
 RewriteCond %{REQUEST_URI} ^/opac/(.*?)/
-RewriteRule - - [E=locale:%1] [L]
+RewriteRule . - [E=locale:%1]
 
 # ----------------------------------------------------------------------------------
 # Configure the OPAC
@@ -203,7 +200,6 @@ RewriteRule - - [E=locale:%1] [L]
     AddType application/xhtml+xml .xml
 </LocationMatch>
 
-RewriteEngine ON
 RewriteCond %{QUERY_STRING} locale=([^&]*)
 RewriteRule ^/opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/(.*)$ /opac/%1/extras/slimpac/$1? [redirect]
 <LocationMatch /opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/>
@@ -213,22 +209,19 @@ RewriteRule ^/opac/[a-z]{2}-[A-Z]{2}/extras/slimpac/(.*)$ /opac/%1/extras/slimpa
 # ----------------------------------------------------------------------------------
 # Run server-side XUL and XHTML through xmlent to load the correct XML entities
 # ----------------------------------------------------------------------------------
-RewriteEngine ON
 RewriteCond %{HTTP:Accept-Language} ([a-z]{2}-[A-Z]{2})
 RewriteRule ^/xul/     -       [E=locale:%1]
-RewriteRule ^/reports/ -       [E=locale:%1] [L]
+RewriteRule ^/reports/ -       [E=locale:%1]
 
 # Default to en-US if we haven't matched a locale of the form xx-YY 
-RewriteEngine ON
 RewriteCond %{HTTP:Accept-Language} !([a-z]{2}-[A-Z]{2})
 RewriteRule ^/xul/     -       [E=locale:en-US]
-RewriteRule ^/reports/ -       [E=locale:en-US] [L]
+RewriteRule ^/reports/ -       [E=locale:en-US]
 
 # Default to en-US if we are just given en
-RewriteEngine ON
 RewriteCond %{ENV:locale} ^$ [OR]
 RewriteCond %{ENV:locale} ^en$
-RewriteRule - - [E=locale:en-US] [L]
+RewriteRule . - [E=locale:en-US]
 
 <LocationMatch /xul/.*\.x?html$>
     Options +Includes
@@ -261,7 +254,6 @@ RewriteRule - - [E=locale:en-US] [L]
     allow from all
 
     # Force clients to use HTTPS
-    RewriteEngine On
     RewriteCond %{HTTPS} !=on [NC]
     RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
 </Location>
@@ -488,7 +480,6 @@ RewriteRule - - [E=locale:en-US] [L]
 # ----------------------------------------------------------------------------------
 # Conify - next-generation Evergreen administration interface
 # ----------------------------------------------------------------------------------
-RewriteEngine on
 RewriteRule ^/conify/([a-z]{2}-[A-Z]{2})/global/(.*)$ /conify/global/$2 [E=locale:$1,L]
 <Location /conify>
     Options +Includes
@@ -513,7 +504,6 @@ RewriteRule ^/conify/([a-z]{2}-[A-Z]{2})/global/(.*)$ /conify/global/$2 [E=local
 # ----------------------------------------------------------------------------------
 RedirectMatch 301 ^/vandelay/vandelay.xml(.*)$ /vandelay/en-US/vandelay.xml$1
 
-RewriteEngine on
 RewriteRule ^/vandelay/([a-z]{2}-[A-Z]{2})/(.*)$ /vandelay/$2 [E=locale:$1]
 
 <LocationMatch /vandelay.*xml>
@@ -540,7 +530,6 @@ RewriteRule ^/vandelay/([a-z]{2}-[A-Z]{2})/(.*)$ /vandelay/$2 [E=locale:$1]
 </Location>
 
 # OpenURL 0.1 searching based on OpenSearch
-RewriteEngine on
 RewriteMap openurl prg:/openils/bin/openurl_map.pl
 RewriteCond %{QUERY_STRING} (^.*$)
 RewriteRule ^/openurl$ ${openurl:%1} [NE,PT]