Bug 26265: (QA follow-up) Remove g option from regex, add few dirs
[koha-equinox.git] / etc / koha-httpd.conf
index e5a0b45..20a9b45 100644 (file)
@@ -31,8 +31,7 @@
 
    # Secure internal stuff
    <DirectoryMatch "__OPAC_WWW_DIR__/.*/(modules|xslt|includes)">
-      Order deny,allow
-      Deny from all
+      Require all denied
    </DirectoryMatch>
 
    <IfModule mod_gzip.c>
      # Rewrite Rules
      RewriteEngine On
 
-     # Uncomment to turn on rewrite logging
-     #RewriteLog __LOG_DIR__/koha-opac-rewrite.log
-     #RewriteLogLevel 1
-
      #The following two directives are unnecessary to proper Koha functioning.
      #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 ^(.*)_(.*).js$ $1.js [N,L]
-     RewriteRule ^(.*)_(.*).css$ $1.css [N,L]
+     RewriteRule ^(.*)_[0-9]{2}\.[0-9]{7}\.(js|css)$ $1.$2 [L]
 
      # REST API configuration
      Alias "/api" "__API_CGI_DIR__"
 
        RewriteEngine On
        RewriteBase /api/
-       RewriteCond %{REQUEST_FILENAME} !-f
-       RewriteCond %{REQUEST_FILENAME} !-d
-       RewriteCond %{DOCUMENT_ROOT}/../api/$1/app.pl -f
-       RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]
+       RewriteCond %{REQUEST_URI} !^/api/v[0-1]+/app.pl
+       RewriteRule ^(v[0-9]+)/(.*)$ /api/$1/app.pl/api/$1/$2 [L]
+
      </Directory>
    </IfModule>
+
+   <IfModule mod_expires.c>
+      ExpiresActive on
+      ExpiresByType text/css "access plus 60 days"
+      ExpiresByType application/javascript "access plus 60 days"
+      ExpiresByType image/png "access plus 12 hours"
+      ExpiresByType image/gif "access plus 12 hours"
+   </IfModule>
 </VirtualHost>
 
 ## Intranet
 
    # Secure internal stuff
    <DirectoryMatch "__INTRANET_WWW_DIR__/.*/(modules|xslt|includes)">
-      Order deny,allow
-      Deny from all
+      Require all denied
    </DirectoryMatch>
 
    <IfModule mod_gzip.c>
      # Rewrite Rules
      RewriteEngine On
 
-     # Uncomment to turn on rewrite logging
-     #RewriteLog __LOG_DIR__/koha-intranet-rewrite.log
-     #RewriteLogLevel 1
-
      #The following two directives are unnecessary to proper Koha functioning.
      #RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*)
      #RewriteRule (.+) $1?%1%2 [N,R,NE]
-     RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/detail\.pl?bib=$1 [PT]
+     RewriteRule ^/bib/([^\/]*)/?$ /cgi-bin/koha/catalogue/detail.pl?biblionumber=$1 [PT]
      RewriteRule ^/isbn/([^\/]*)/?$ /search?q=isbn:$1 [PT]
      RewriteRule ^/issn/([^\/]*)/?$ /search?q=issn:$1 [PT]
-     RewriteRule ^(.*)_(.*).js$ $1.js [N,L]
-     RewriteRule ^(.*)_(.*).css$ $1.css [N,L]
+     RewriteRule ^(.*)_[0-9]{2}\.[0-9]{7}\.(js|css)$ $1.$2 [L]
 
 
      # REST API configuration
 
        RewriteEngine On
        RewriteBase /api/
-       RewriteCond %{REQUEST_FILENAME} !-f
-       RewriteCond %{REQUEST_FILENAME} !-d
-       RewriteCond %{DOCUMENT_ROOT}/../api/$1/app.pl -f
-       RewriteRule ^(.*?)/.* $1/app.pl/api/$0 [L]
+       RewriteCond %{REQUEST_URI} !^/api/v[0-1]+/app.pl
+       RewriteRule ^(v[0-9]+)/(.*)$ /api/$1/app.pl/api/$1/$2 [L]
      </Directory>
    </IfModule>
+
+   <IfModule mod_expires.c>
+      ExpiresActive on
+      ExpiresByType text/css "access plus 60 days"
+      ExpiresByType application/javascript "access plus 60 days"
+      ExpiresByType image/png "access plus 12 hours"
+      ExpiresByType image/gif "access plus 12 hours"
+   </IfModule>
 </VirtualHost>
 
 # Uncomment this VirtualHost to enable API access through