RewriteEngine On
RewriteBase /
Options +FollowSymlinks
Options -Indexes

# Przekierowanie z www na bez www i z http na https w jednym kroku
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]

# Przekierowanie z http na https, jesli nie zawiera www
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/(tpay-status|platnosc-status|przelewy24-status)$ [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Usuwanie koncowego slasha dla niekatalogów
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/admin/.*$ [NC]
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]

RewriteCond %{REQUEST_URI}  !^(.*)/libraries/(.*) [NC]
RewriteCond %{REQUEST_URI}  !^(.*)/layout/(.*) [NC]
RewriteRule ^admin/([^/]*)/([^/]*)/(.*)$ admin/index.php?module=$1&action=$2&$3 [L]

RewriteRule ^admin/$ admin/index.php [L]

RewriteRule ^thumb/([0-9]*)/([0-9]*)/(.*)$ /libraries/thumb.php?img=$3&w=$1&h=$2 [L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.php
RewriteRule ^ /%1 [R=301,L]
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
</IfModule>
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault                                      "access plus 1 month"
ExpiresByType text/css                              "access plus 1 year"
ExpiresByType application/json                      "access plus 0 seconds"
ExpiresByType application/xml                       "access plus 0 seconds"
ExpiresByType text/xml                              "access plus 0 seconds"
ExpiresByType image/x-icon                          "access plus 1 week"
ExpiresByType text/x-component                      "access plus 1 month"
ExpiresByType text/html                             "access plus 0 seconds"
ExpiresByType application/javascript                "access plus 1 year"
ExpiresByType application/x-web-app-manifest+json   "access plus 0 seconds"
ExpiresByType text/cache-manifest                   "access plus 0 seconds"
ExpiresByType audio/ogg                             "access plus 1 month"
ExpiresByType image/gif                             "access plus 1 month"
ExpiresByType image/jpeg                            "access plus 1 month"
ExpiresByType image/png                             "access plus 1 month"
ExpiresByType video/mp4                             "access plus 1 month"
ExpiresByType video/ogg                             "access plus 1 month"
ExpiresByType video/webm                            "access plus 1 month"
ExpiresByType application/atom+xml                  "access plus 1 hour"
ExpiresByType application/rss+xml                   "access plus 1 hour"
ExpiresByType application/font-woff                 "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject         "access plus 1 month"
ExpiresByType application/x-font-ttf                "access plus 1 month"
ExpiresByType font/opentype                         "access plus 1 month"
ExpiresByType image/svg+xml                         "access plus 1 month"
</IfModule>
<Files *.conf>
  Order Deny,Allow
  Deny from all
</Files>
<Files *.log>
  Order Deny,Allow
  Deny from all
</Files>
<Files *.ini>
  Order Deny,Allow
  Deny from all
</Files>

RewriteCond %{REQUEST_URI} ^/home$
RewriteRule ^(.*)$ http://www.shoppro.project-dc.pl/ [R=permanent,L]
RewriteCond %{REQUEST_URI} ^/home-1$
RewriteRule ^(.*)$ http://www.shoppro.project-dc.pl/ [R=permanent,L]
RewriteRule ^$ index.php?a=page&id=6&lang=pl [L]
RewriteCond %{REQUEST_URI} ^/home-en$
RewriteRule ^(.*)$ http://www.shoppro.project-dc.pl/en/ [R=permanent,L]
RewriteCond %{REQUEST_URI} ^/home-en-1$
RewriteRule ^(.*)$ http://www.shoppro.project-dc.pl/en/ [R=permanent,L]
RewriteRule ^$ index.php?a=page&id=6&lang=en [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]