web staff : repair apache configuration
authorBill Erickson <berick@esilibrary.com>
Wed, 11 Dec 2013 16:33:33 +0000 (11:33 -0500)
committerBill Erickson <berick@esilibrary.com>
Wed, 11 Dec 2013 16:33:33 +0000 (11:33 -0500)
Location per app is no longer necessary.  LocationMatch now supports
arbitrary nesting.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/examples/apache/eg_vhost.conf.in
Open-ILS/examples/apache_24/eg_vhost.conf.in

index 45487ec..32ebd26 100644 (file)
@@ -787,20 +787,19 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT]
     </IfModule>
 </Location>
 
-# TODO: as is, each sub-app will require a new Location entry, which
-# will quickly grow large (and it's unnecessary and annoying). we need a
-# better solution.
-<Location /eg/staff/>
+<LocationMatch /eg/staff/>
     Options -MultiViews
-    # any reuest that does not map to a template file
-    # is redirected to the index.  This allows us to 
-    # map multiple routes to the same application.
+
+    # map /eg/staff to /eg/staff/index
+    RewriteEngine On
+    RewriteCond %{PATH_INFO} =/staff/
+    RewriteRule (.*) /eg/staff/index [L,DPI]
+
+    # map /eg/staff/foo/bar to /eg/staff/foo/index
     RewriteEngine On
-    RewriteCond %{PATH_INFO} !/staff/index
-    RewriteCond %{PATH_INFO} !/staff/t_*
-    RewriteRule .* /eg/staff/index [L,DPI]
+    RewriteCond %{PATH_INFO} !.*/(index|css|t_*)
+    RewriteRule (.*)/[^\/]+$ $1/index [L,DPI]
 
-    # is this redundant?
     <IfModule mod_headers.c>
         Header append Cache-Control "public"
     </IFModule>
@@ -814,21 +813,7 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT]
             Header append Vary User-Agent env=!dont-vary
         </IfModule>
     </IfModule>
-</Location>
-<Location /eg/staff/cat/bucket/record/>
-    Options -MultiViews
-    RewriteEngine On
-    RewriteCond %{PATH_INFO} !/staff/cat/bucket/record/index
-    RewriteCond %{PATH_INFO} !/staff/cat/bucket/record/t_*
-    RewriteRule .* /eg/staff/cat/bucket/record/index [L,DPI]
-</Location>
-<Location /eg/staff/circ/patron/>
-    Options -MultiViews
-    RewriteEngine On
-    RewriteCond %{PATH_INFO} !/staff/circ/patron/index
-    RewriteCond %{PATH_INFO} !/staff/circ/patron/t_*
-    RewriteRule .* /eg/staff/circ/patron/index [L,DPI]
-</Location>
+</LocationMatch>
 
 <Location /js/>
     <IfModule mod_headers.c>
index 3e07b09..1f90e84 100644 (file)
@@ -799,20 +799,19 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT]
     </IfModule>
 </Location>
 
-# TODO: as is, each sub-app will require a new Location entry, which
-# will quickly grow large (and it's unnecessary and annoying). we need a
-# better solution.
-<Location /eg/staff/>
+<LocationMatch /eg/staff/>
     Options -MultiViews
-    # any reuest that does not map to a template file
-    # is redirected to the index.  This allows us to 
-    # map multiple routes to the same application.
+
+    # map /eg/staff to /eg/staff/index
+    RewriteEngine On
+    RewriteCond %{PATH_INFO} =/staff/
+    RewriteRule (.*) /eg/staff/index [L,DPI]
+
+    # map /eg/staff/foo/bar to /eg/staff/foo/index
     RewriteEngine On
-    RewriteCond %{PATH_INFO} !/staff/index
-    RewriteCond %{PATH_INFO} !/staff/t_*
-    RewriteRule .* /eg/staff/index [L,DPI]
+    RewriteCond %{PATH_INFO} !.*/(index|css|t_*)
+    RewriteRule (.*)/[^\/]+$ $1/index [L,DPI]
 
-    # is this redundant?
     <IfModule mod_headers.c>
         Header append Cache-Control "public"
     </IFModule>
@@ -826,21 +825,7 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT]
             Header append Vary User-Agent env=!dont-vary
         </IfModule>
     </IfModule>
-</Location>
-<Location /eg/staff/cat/bucket/record/>
-    Options -MultiViews
-    RewriteEngine On
-    RewriteCond %{PATH_INFO} !/staff/cat/bucket/record/index
-    RewriteCond %{PATH_INFO} !/staff/cat/bucket/record/t_*
-    RewriteRule .* /eg/staff/cat/bucket/record/index [L,DPI]
-</Location>
-<Location /eg/staff/circ/patron/>
-    Options -MultiViews
-    RewriteEngine On
-    RewriteCond %{PATH_INFO} !/staff/circ/patron/index
-    RewriteCond %{PATH_INFO} !/staff/circ/patron/t_*
-    RewriteRule .* /eg/staff/circ/patron/index [L,DPI]
-</Location>
+</LocationMatch>
 
 <Location /js/>
     <IfModule mod_headers.c>