# This file is part of OPUS. The software OPUS has been originally developed
# at the University of Stuttgart with funding from the German Research Net,
# the Federal Department of Higher Education and Research and the Ministry
# of Science, Research and the Arts of the State of Baden-Wuerttemberg.
# 
# OPUS 4 is a complete rewrite of the original OPUS software and was developed
# by the Stuttgart University Library, the Library Service Center
# Baden-Wuerttemberg, the Cooperative Library Network Berlin-Brandenburg,
# the Saarland University and State Library, the Saxon State Library -
# Dresden State and University Library, the Bielefeld University Library and
# the University Library of Hamburg University of Technology with funding from
# the German Research Foundation and the European Regional Development Fund.
# 
# LICENCE
# OPUS is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the Licence, or any later version.
# OPUS is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details. You should have received a copy of the GNU General Public License 
# along with OPUS; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# 
# @category    Application
# @author      Ralf Claussnitzer (ralf.claussnitzer@slub-dresden.de)
# @author      Thoralf Klein <thoralf.klein@zib.de>
# @copyright   Copyright (c) 2008-2011, OPUS 4 development team
# @license     http://www.gnu.org/licenses/gpl.html General Public License
# @version     $Id: htaccess-template 9272 2011-11-23 16:15:43Z sszott $

# Configure environment for application (testing, production)
# The default is "production" if APPLICATION_ENV is not configured here.
# SetEnv APPLICATION_ENV testing

# Configure on rewriting. Note that the rewrite base has to be adjusted to the base url of the application.
# Replace <template> with correct path e.g. /MyProject/public/
RewriteEngine on
RewriteBase <template>

# Rewrite rule for file delivery
RewriteRule ^files/(\d+)/(.*)$ "frontdoor/deliver/index/docId/$1/file/$2" [L,R]

# Rewrite rule to remove index.php in request URL
RewriteRule ^index.php/ <template> [L]

# Rewrite rule for unknown file icons in the frontdoor
RewriteCond %{REQUEST_URI} layouts/[^/]*/img/filetype/
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^layouts/([^/]+)/img/filetype/.*$ layouts/$1/img/filetype/application_octet-stream.png [L,R=301]

# Rewrite rule to prevent access to common.phtml
RewriteRule ^layouts/[^/]+/common.phtml$ <template> [L]

# Rewrite rule for the delivery of static resources
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]

# all other requests are handled by the webapp itself
RewriteRule ^.*$ index.php [L]

# Security: Don't allow browsing of directories
Options -Indexes

# PHP settings
php_flag magic_quotes_gpc off
php_flag register_globals off
php_flag short_open_tag on

# Setting cookie options
php_value session.cookie_path    <template>

# On Debian/Ubuntu, prevent PHP from deleting the cookies
#Enable for UBUNTU/DEBIAN:# php_value session.gc_probability 0
