[open-ils-commits] r11489 - branches/rel_1_4/Open-ILS/examples/apache
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Dec 9 23:18:59 EST 2008
Author: dbs
Date: 2008-12-09 23:18:57 -0500 (Tue, 09 Dec 2008)
New Revision: 11489
Modified:
branches/rel_1_4/Open-ILS/examples/apache/eg_vhost.conf
Log:
Backport locale Apache config simplifications from trunk
Modified: branches/rel_1_4/Open-ILS/examples/apache/eg_vhost.conf
===================================================================
--- branches/rel_1_4/Open-ILS/examples/apache/eg_vhost.conf 2008-12-10 04:16:27 UTC (rev 11488)
+++ branches/rel_1_4/Open-ILS/examples/apache/eg_vhost.conf 2008-12-10 04:18:57 UTC (rev 11489)
@@ -37,11 +37,22 @@
RewriteRule ^/opac/extras/ac/jacket/(small|medium|large)/$ \
/opac/images/blank.png [P,L]
+# ----------------------------------------------------------------------------------
+# 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}]
+RewriteRule - - [E=OILS_TIME_YEAR:%{TIME_YEAR}] [L]
+
# ----------------------------------------------------------------------------------
+# Pull the locale from the URL
+# ----------------------------------------------------------------------------------
+RewriteEngine ON
+RewriteCond %{REQUEST_URI} ^/opac/(.*?)/
+RewriteRule - - [E=locale:%1] [L]
+
+# ----------------------------------------------------------------------------------
# Configure the OPAC
# ----------------------------------------------------------------------------------
<LocationMatch /opac/>
@@ -60,10 +71,6 @@
AddOutputFilter INCLUDES .xsl
AddOutputFilter INCLUDES;XMLENT .xml
- # add languages as necessary
- SetEnvIf Request_URI "/en-US/" locale=en-US
- SetEnvIf Request_URI "/fr-CA/" locale=fr-CA
- SetEnvIf Request_URI "/hy-AM/" locale=hy-AM
SetEnvIf Request_URI ".*" OILS_OPAC_BASE=/opac/
# This gives you the option to configure a different host to serve OPAC images from
@@ -89,20 +96,31 @@
RewriteEngine ON
RewriteCond %{QUERY_STRING} locale=([^&]*)
-RewriteRule ^/opac/[^/]+/extras/slimpac/(.*)$ /opac/%1/extras/slimpac/$1? [redirect]
-<LocationMatch /opac/[^/]+/extras/slimpac/>
+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/>
AddOutputFilter INCLUDES;XMLENT .html
</LocationMatch>
# ----------------------------------------------------------------------------------
# Run server-side XUL and XHTML through xmlent to load the correct XML entities
# ----------------------------------------------------------------------------------
-<LocationMatch /xul>
- SetEnvIfNoCase Accept-Language "en" locale=en-US
- SetEnvIfNoCase Accept-Language "fr-CA" locale=fr-CA
- SetEnvIfNoCase Accept-Language "hy-AM" locale=hy-AM
-</LocationMatch>
+RewriteEngine ON
+RewriteCond %{HTTP:Accept-Language} ([a-z]{2}-[A-Z]{2})
+RewriteRule ^/xul/ - [E=locale:%1]
+RewriteRule ^/reports/ - [E=locale:%1] [L]
+# 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]
+
+# 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]
+
<LocationMatch /xul/.*\.xhtml$>
Options +Includes
XMLEntEscapeScript "no"
@@ -271,9 +289,6 @@
# ----------------------------------------------------------------------------------
<LocationMatch /reports>
Options +Includes
- SetEnvIfNoCase Accept-Language "en" locale=en-US
- SetEnvIfNoCase Accept-Language "fr-CA" locale=fr-CA
- SetEnvIfNoCase Accept-Language "hy-AM" locale=hy-AM
AddOutputFilter INCLUDES;XMLENT .xhtml
</LocationMatch>
<LocationMatch /reports/fm_IDL.xml>
@@ -299,7 +314,7 @@
# Conify - next-generation Evergreen administration interface
# ----------------------------------------------------------------------------------
RewriteEngine on
-RewriteRule ^/conify/(.*)/global/(.*)$ /conify/global/$2 [E=locale:$1]
+RewriteRule ^/conify/([a-z]{2}-[A-Z]{2})/global/(.*)$ /conify/global/$2 [E=locale:$1,L]
<Location /conify>
XMLEntStripPI "yes"
XMLEntEscapeScript "no"
@@ -320,13 +335,12 @@
# ----------------------------------------------------------------------------------
# Vandelay importers / exporters (your Web interface to bibliographic travel)
# ----------------------------------------------------------------------------------
-# capture the locale from the URL
-AliasMatch ^/vandelay/.*/vandelay.xml(.*) /openils/var/web/vandelay/vandelay.xml$1
+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>
- RewriteEngine on
- SetEnv locale en-US
- SetEnvIf Request_URI "/en-US/" locale=en-US
- SetEnvIf Request_URI "/fr-CA/" locale=fr-CA
XMLEntStripPI "yes"
XMLEntEscapeScript "no"
XMLEntStripComments "yes"
@@ -349,8 +363,6 @@
allow from all
</Location>
-
-
# OpenURL 0.1 searching based on OpenSearch
RewriteEngine on
RewriteMap openurl prg:/openils/bin/openurl_map.pl
More information about the open-ils-commits
mailing list