Advertisement
Dyrcona

Domain Rewrite Rules

Jun 25th, 2018
609
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. # First, we need to set the OPAC_LIBRARY_ID environment variable. This should be in
  2. # eg_vhost.conf already.
  3. #----------------------------------------------------------------------------------
  4. # Add the library ID (OILS_OPAC_LIBRARY_ID)
  5. #----------------------------------------------------------------------------------
  6. RewriteEngine ON
  7. RewriteCond %{QUERY_STRING} (^loc|&loc|;loc|^locg|&locg|;locg)=(\d+)
  8. RewriteRule . - [E=OILS_OPAC_LIBRARY_ID:%2]
  9.  
  10. # Further down, we add the RewriteMap entries for the configuration files in the
  11. # eg_vhost.conf:
  12. RewriteMap lowercase int:tolower
  13. RewriteMap libcode txt:/openils/conf/libcode.txt
  14. RewriteMap libtarget txt:/openils/conf/libtarget.txt
  15. RewriteRule . - [E=libcode:${libcode:${lowercase:%{HTTP_HOST}}|CWMARS}]
  16. RewriteRule . - [E=libtarget:${libtarget:%{ENV:libcode}}]
  17. RewriteRule . - [E=OILS_OPAC_LIBRARY_ID:${libtarget:%{ENV:libcode}}]
  18. RewriteRule . - [E=physical_loc:${libtarget:%{ENV:libcode}}]
  19.  
  20. # The above depends on having two files: /openils/conf/libcode.txt and
  21. # /openils/conf/libtarget.txt.
  22.  
  23. # libcode.txt has line entries like the following
  24. host.domain.tld code
  25. # Where host.domain.tld is the fully qualified domain name of the site and code
  26. # is a code to represent the library. (We use the library's shortname from the
  27. # actor.org_unit table as the code.)
  28.  
  29. # libtarget.txt has line entries like the following:
  30. code id
  31. # Where code is the code from libcode.txt and id is the location's id from the
  32. # actor.org_unit table.
  33.  
  34. # If there's more to it, I'm not sure. :)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement