##### start generated .htaccess code #####

##### start generic codes #####
Options +FollowSymlinks -Indexes
DirectoryIndex index.php index.html
AddDefaultCharset utf-8

<files .htaccess>
    order allow,deny
    deny from all
</files>

<FilesMatch ".(doc|pdf)$">
    <ifModule mod_headers.c>
        Header set X-Robots-Tag "noindex, nofollow, noarchive, nosnippet"
    </ifModule>    
</FilesMatch>

<FilesMatch "robots.txt">
    <ifModule mod_headers.c>
        Header set X-Robots-Tag "noindex"
    </ifModule>    
</FilesMatch>

<FilesMatch "sitemap.xml">
    <ifModule mod_headers.c>
        Header set X-Robots-Tag "noindex"
    </ifModule>    
</FilesMatch>

<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule>
<ifModule mod_headers.c>
    Header set Connection keep-alive
</ifModule>
##### end generic codes #####

##### start force ssl/non-ssl #####
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_USER_AGENT} !cloudfront [NC]
RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"'
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
##### end force ssl/non-ssl #####

##### start force www/non-www #####
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_USER_AGENT} !cloudfront [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
##### end force www/non-www #####

##### start gzip/deflate compression #####
<IfModule mod_deflate.c>
    AddOutputFilter DEFLATE js css json
    <IfModule mod_setenvif.c>
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
        BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
    </IfModule>
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
    </IfModule>
</IfModule>

<IfModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file \.(html?|txt|css|js|php|pl|json)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^application/x-javascript.*
    mod_gzip_item_include mime ^application/json
    mod_gzip_item_exclude mime ^image/.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
    
    gzip_comp_level 2;
    gzip_http_version 1.0;
    gzip_proxied any;
    gzip_min_length 1100;
    gzip_buffers 16 8k;
    gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_disable “MSIE [1–6].(?!.*SV1)”;
    gzip_vary on;
    
</IfModule>
##### end gzip/deflate compression #####
<IfModule mod_rewrite.c>
RewriteRule ^cms/([0-9]+)/[a-z0-9-]+/?$ admin/backend/cms.php?id=$1 [L]
</IfModule>
##### end generated .htaccess code #####

