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

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

<Files *.gif.webp>
  AddType "image/webp" .webp
  AddEncoding webp .webp
</Files>
<Files *.gif.apng>
  AddType "image/png" .apng
  AddEncoding apng .apng
</Files>

<Files "ldap.php">
        Deny from all
</Files>
<Files "update.php">
        Deny from all
</Files>
<Files "config.php">
        Deny from all
</Files>
<Files "database.php">
        Deny from all
</Files>

<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 /

        #Checks to see if the browser supports webp or apng,
        #where a .webp or .apng version exists
        RewriteCond %{REQUEST_URI} (\.gif|\.png)$ [NC]
        RewriteCond %{HTTP_USER_AGENT} "Chrome/[0-9][0-9]\." [NC]
        RewriteCond %{HTTP_USER_AGENT} "^Edge/[0-9][0-9]\." [NC]
        RewriteCond %{REQUEST_FILENAME}.webp -f
        RewriteRule ^(.*)$ $1.webp [L]

        RewriteCond %{REQUEST_URI} (\.gif|\.png)$ [NC]
        RewriteCond %{HTTP_USER_AGENT} "Safari/[0-9][0-9][0-9]\." [NC,OR]
        RewriteCond %{HTTP_USER_AGENT} "Firefox/[0-9][0-9]\." [NC]
        RewriteCond %{REQUEST_FILENAME}.apng -f
        RewriteRule ^(.*)$ $1.apng [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 350M
        php_value post_max_size 350M
        php_value max_input_time 600
    </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 350M
        php_value post_max_size 350M
        php_value max_input_time 600
    </IfModule>

    <IfModule expires_module>
            SetEnv HTTP_MOD_EXPIRES On

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

            <FilesMatch "\.(ico|gif|jpg|jpeg|png|css|js|html)$">
                ExpiresActive On
                ExpiresDefault "access plus 1 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>
