################################################################################
# ConLite AMR plugin simple rewrite rules set.
#
# Contains few easy to handle rewrite rules.
#
# @version    1.0.0
# @author     Ortwin Pinke <ortwin.pinke@php-backoffice.de>
# @author     Murat Purc <murat@purc.de>
# @copyright  2019 ConLite Team
# @link       http://www.conlite.org
#
# Versions before 1.0 copyright 4fb, author Murat Purc
#
# $Id: htaccess_simple.txt 145 2019-10-25 16:00:47Z oldperl $
################################################################################

# easily set this enviroment variable to the config you want to use
# add a config folder with the same name in data/config and cms/data/config
# and use your custom config for development

#SetEnv CONLITE_ENVIRONMENT develop

<IfModule mod_rewrite.c>

    # Enable rewrite engine
    RewriteEngine on

    # Specify a base URL-path for the rules
    RewriteBase /cms

    # Catch some common exploits in query string to get rid of them
    # NOTE: Conditions to prevent protocols (ftp, http[s]) in query string could
    #       be a disadvantage in some cases
    RewriteCond %{QUERY_STRING} contenido_path=.*$  [NC,OR]
    RewriteCond %{QUERY_STRING} cfg\[path\]=.*$  [NC,OR]
    RewriteCond %{QUERY_STRING} _PHPLIB\[libdir\]=.*$  [NC,OR]
    RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
    RewriteCond %{QUERY_STRING} ftp://.*$  [NC,OR]
    RewriteCond %{QUERY_STRING} http[s]*://.*$ [NC]
    RewriteRule ^.* - [F,L,DPI]  # all matching conditions from above will end in nirvana

    # Rewrite request to root to front_content.php
    RewriteRule ^$ front_content.php [QSA,L]

    # Exclude following request from rewriting
    # tests for favicon.ico, valid symlinks (-s), not empty files (-l) and folders (-d)
    RewriteCond %{REQUEST_URI} ^/favicon.ico$ [OR]
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L,DPI]

    # Pass other requests to front_content.php
    RewriteRule ^.*$ front_content.php [QSA,NC,L]

</IfModule>

# Some rules to compress files.
# NOTE: Following settings are not mod rewrite specific, but enabling mod_deflate
#       for some file types can help to reduce bandwith.
<IfModule mod_deflate.c>
    <FilesMatch "\.(js|css|html|htm|php|xml)$">
        SetOutputFilter DEFLATE
    </FilesMatch>
</IfModule>
