Koha/debian/templates/apache-shared-opac.conf
David Cook c6b50f0bac Bug 21031: Apache Rewrite rules don't work for API when using anything but Debian package Plack configuration
The Rewrite rules for Apache don't work unless you're using
debian/templates/apache-shared-opac-plack.conf or
debian/templates/apache-shared-intranet-plack.conf.

This patch fixes the Rewrite rules for the non-Plack Debian
Apache configuration templates as well as the standard
Apache configuration file that comes with Koha.

__BEFORE APPLYING__
1. Visit /api/v1/app.pl/api/v1/spec on your git dev install
2. This should display a large page of JSON
3. Visit /api/v1/spec on your git dev install
4. This should generate a 404 error

__APPLY PATCH__

__AFTER APPLYING__
5. Visit /api/v1/app.pl/api/v1/spec on your git dev install
6. This should display a large page of JSON
7. Visit /api/v1/spec on your git dev install
8. This should display a large page of JSON (identical to
the one from earlier steps)

Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Passed QA with few notes posted separately to Bugzilla.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2018-08-02 10:23:08 -03:00

39 lines
1.4 KiB
Text

# Apache configuration settings that are shared for every Koha instance.
# This file contains settings for the OPAC site.
#
# This file should be included from an instance's
# /etc/apache2/site-available file, from within the VirtualHost section
# for OPAC.
DocumentRoot /usr/share/koha/opac/htdocs
ScriptAlias /cgi-bin/koha/ "/usr/share/koha/opac/cgi-bin/opac/"
ScriptAlias /index.html "/usr/share/koha/opac/cgi-bin/opac/opac-main.pl"
ScriptAlias /search "/usr/share/koha/opac/cgi-bin/opac/opac-search.pl"
ScriptAlias /opac-search.pl "/usr/share/koha/opac/cgi-bin/opac/opac-search.pl"
RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
RewriteRule (.+) $1?%1%2 [N,R,NE]
RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/opac-detail\.pl?bib=$1 [PT]
RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
RewriteRule ^(.*)_[0-9]{2}\.[0-9]{7}\.(js|css)$ $1.$2 [L]
<IfVersion >= 2.4>
AliasMatch "^/sitemap(.*)" "/var/lib/koha/${instance}/sitemap/sitemap$1"
<Directory "/var/lib/koha/${instance}/sitemap">
Require all granted
</Directory>
</IfVersion>
Alias "/api" "/usr/share/koha/api"
<Directory "/usr/share/koha/api">
Options +ExecCGI +FollowSymlinks
AddHandler cgi-script .pl
SetEnv MOJO_MODE "production"
RewriteBase /api/
RewriteCond %{REQUEST_URI} !^/api/v[0-1]+/app.pl
RewriteRule ^(v[0-9]+)/(.*)$ /api/$1/app.pl/api/$1/$2 [L]
</Directory>