#
# DO NOT MODIFY THIS FILE DIRECTLY.
# USE THE APACHE CONF FILES TO ALTER SETTINGS.
#

#No folder listing
Options -Indexes

AddType application/x-java-jnlp-file .jnlp
AddType application/x-web-app-manifest+json .webapp

<Files "ldap.php">
        Require all denied
</Files>
<Files "update.php">
        Require all denied
</Files>
<Files "config.php">
        Require all denied
</Files>
<Files "database.php">
        Require all denied
</Files>
<Files ~ "\.(bat)$"> 
        Require all denied
</Files>
<FilesMatch "log-2.*\.php">
    Require all denied
</FilesMatch>

<IfModule !env_module>
    DirectoryIndex install.php
</IfModule>

<IfModule env_module>
    DirectoryIndex index_us.php index.html

    SetEnv HTTP_MOD_ENV On

    <IfModule rewrite_module>
        SetEnv HTTP_MOD_REWRITE On

        #CGI mode PHP auth fix
        SetEnvIfNoCase Authorization "Basic ([a-z0-9=]+)" US_HTTP_AUTHORIZATION=$1

        RewriteEngine On
        #RewriteBase /

        #Block access to certain directories
        RewriteRule ^application/(.*)$ select.html [L]
        RewriteRule ^exec/(.*)$ select.html [L]
        RewriteRule ^installer/(.*)$ select.html [L]
        RewriteRule ^java/(.*)$ select.html [L]
        RewriteRule ^system/(.*)$ select.html [L]
        RewriteRule ^writeable/cache/(.*)$ select.html [L]
        RewriteRule ^writeable/logs/(.*)$ select.html [L]
        RewriteRule ^writeable/temp/(.*)$ select.html [L]
        RewriteRule ^writeable/updates/(.*)$ select.html [L]

        RewriteRule ^(css|cssc|js|jsc|mobile_assets)/(.*)__[\.\d]*\.(css|js)$ $1/$2.$3 [L]

        #Checks to see if the user is attempting to access a valid file,
        #such as an image or css document, if this isn't true it sends the
        #request to index_us.php
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index_us.php?/$1 [PT,L]
    </IfModule>

    <IfModule !rewrite_module>
        DirectoryIndex install.php
    </IfModule>

    <IfModule !php5_module>
        <IfModule !php7_module>
            DirectoryIndex install.html
        </IfModule>
    </IfModule>

    <IfModule php5_module>
        php_flag register_globals off
        php_flag magic_quotes_gpc off
        php_value memory_limit 1350M
        php_value upload_max_filesize 50M
        php_value post_max_size 55M
        php_value max_input_time 600

        <Files "index_upload.php">
            php_value upload_max_filesize 2000M
            php_value post_max_size 2048M
        </Files>
    </IfModule>
    <IfModule php7_module>
        php_flag register_globals off
        php_flag magic_quotes_gpc off
        php_value memory_limit 1350M
        php_value upload_max_filesize 50M
        php_value post_max_size 55M
        php_value max_input_time 600

        <Files "index_upload.php">
            php_value upload_max_filesize 2000M
            php_value post_max_size 2048M
        </Files>
    </IfModule>

    <IfModule expires_module>
            SetEnv HTTP_MOD_EXPIRES On

            ExpiresActive On
            ExpiresByType image/gif "access plus 10 month"
            ExpiresByType image/jpeg "access plus 10 month"
            ExpiresByType image/png "access plus 10 month"

            <FilesMatch "\.(css|js|html)$">
                ExpiresActive On
                ExpiresDefault "access plus 1 month"
            </FilesMatch>
            <FilesMatch "\.(ico|gif|jpg|jpeg|png|apng|svg|ttf|woff|woff2|eot)$">
                ExpiresActive On
                ExpiresDefault "access plus 10 month"
            </FilesMatch>
    </IfModule>

    <IfModule !expires_module>
            DirectoryIndex install.php
    </IfModule>

    <IfModule deflate_module>
            AddOutputFilterByType DEFLATE text/html text/plain text/css application/javascript
    </IfModule>

</IfModule>
