<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Redirect /index.php/anything to /anything
    RewriteCond %{THE_REQUEST} /index\.php/([^\s?]*) [NC]
    RewriteRule ^index\.php/(.*)$ /$1 [L,R=301,NC]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

## contrôle du cache navigateur - Expire headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 7200 seconds"

# Images
ExpiresByType image/jpg                "access plus 1 month"
ExpiresByType image/jpeg               "access plus 1 month"
ExpiresByType image/png                "access plus 1 month"
ExpiresByType image/gif                "access plus 1 month"
ExpiresByType image/svg+xml            "access plus 1 month"

# Video
ExpiresByType video/webm               "access plus 1 year"
ExpiresByType video/mp4                "access plus 1 year"
ExpiresByType video/mpeg               "access plus 1 year"

# Fonts
ExpiresByType font/ttf                 "access plus 1 year"
ExpiresByType font/otf                 "access plus 1 year"
ExpiresByType font/woff                "access plus 1 year"
ExpiresByType font/woff2               "access plus 1 year"
ExpiresByType application/font-woff    "access plus 1 year"

# Icons
AddType image/x-icon .ico
ExpiresByType image/ico                "access plus 1 year"
ExpiresByType image/icon               "access plus 1 year"
ExpiresByType image/x-icon             "access plus 1 year"

# CSS, JavaScript
ExpiresByType text/css                 "access plus 1 month"
ExpiresByType text/javascript          "access plus 1 month"
ExpiresByType application/javascript   "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType text/html                "access plus 7200 seconds"
ExpiresByType application/xhtml+xml    "access plus 7200 seconds"

# Others
ExpiresByType application/pdf          "access plus 1 month"
ExpiresByType image/vnd.microsoft.icon "access plus 1 year"
</IfModule>

<IfModule mod_headers.c>
<FilesMatch "\\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
<FilesMatch "\\.(css)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
<FilesMatch "\\.(js)$">
Header set Cache-Control "max-age=216000, private"
</FilesMatch>
</IfModule>

<IfModule mod_deflate.c>
<FilesMatch "\.(ttf|otf|eot|svg)$" >
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
