AddDefaultCharset utf-8
AddType application/x-font-woff2 .woff2 

ErrorDocument 404 /page_404.php

SetEnv SESSION_USE_TRANS_SID 0

#Options +FollowSymlinks

<IfModule mod_rewrite.c>
  RewriteEngine On
  
  # remove slash at the end
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} /(.*)/$
  RewriteRule ^ /%1 [R=301,L] 
  
  # page URL Rewriting
  RewriteRule ^(admin)($|/) - [QSA,L]
  RewriteRule ^([A-Za-z0-9\-_]+)$ page.php?page_name=$1 [QSA,L]
  
  # HTTP TO HTTPS
  RewriteCond %{HTTPS} !=on
  RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{REQUEST_URI} /(.*)/$
  #RewriteRule ^ /%1 [R=301,L]

  #RewriteRule ^offre-([0-9]+)-([A-Za-z0-9\-_]+)$ offre.php?id=$1
  #RewriteRule ^mentions-legales$ mentions-legales.php [QSA,L]
</IfModule>

<IfModule mod_headers.c>
	Header set Connection keep-alive
	Header append Vary: Accept-Encoding
	Header set X-XSS-Protection "1; mode=block"
	Header always append X-Frame-Options SAMEORIGIN
	Header set X-Content-Type-Options: "nosniff"
	Header unset Server  
	Header unset X-Powered-By
</IfModule>

<IfModule mod_deflate.c>
	<FilesMatch "\.(html|php|txt|xml|js|css|ttf|svg)$">
	SetOutputFilter DEFLATE
	</FilesMatch>
</IfModule>

<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault                                      "access plus 1 year"

  # CSS
    ExpiresByType text/css                              "access plus 1 year"

  # Data interchange
    ExpiresByType application/json                      "access plus 0 seconds"
    ExpiresByType application/ld+json                   "access plus 0 seconds"
    ExpiresByType application/vnd.geo+json              "access plus 0 seconds"
    ExpiresByType application/xml                       "access plus 0 seconds"
    ExpiresByType text/xml                              "access plus 0 seconds"

  # Favicon (cannot be renamed!) and cursor images
    ExpiresByType image/x-icon                          "access plus 1 week"

  # HTML components (HTCs)
    ExpiresByType text/x-component                      "access plus 1 year"

  # HTML
    ExpiresByType text/html                             "access plus 0 seconds"

  # JavaScript
	  ExpiresByType application/javascript 				        "access plus 1 year"
	  ExpiresByType application/x-javascript 			        "access plus 1 year"
    ExpiresByType text/javascript                		    "access plus 1 year"

  # Manifest files
    ExpiresByType application/manifest+json             "access plus 1 year"
    ExpiresByType application/x-web-app-manifest+json   "access plus 0 seconds"
    ExpiresByType text/cache-manifest                   "access plus 0 seconds"

  # Media
    ExpiresByType audio/ogg                             "access plus 1 year"
    ExpiresByType image/gif                             "access plus 1 year"
    ExpiresByType image/jpeg                            "access plus 1 year"
    ExpiresByType image/png                             "access plus 1 year"
    ExpiresByType video/mp4                             "access plus 1 year"
    ExpiresByType video/ogg                             "access plus 1 year"
    ExpiresByType video/webm                            "access plus 1 year"

  # Web feeds
    ExpiresByType application/atom+xml                  "access plus 1 hour"
    ExpiresByType application/rss+xml                   "access plus 1 hour"

  # Web fonts
    ExpiresByType application/font-woff                 "access plus 1 year"
    ExpiresByType application/font-woff2                "access plus 1 year"
    ExpiresByType application/vnd.ms-fontobject         "access plus 1 year"
    ExpiresByType application/x-font-ttf                "access plus 1 year"
    ExpiresByType font/opentype                         "access plus 1 year"
    ExpiresByType image/svg+xml                         "access plus 1 year"
</IfModule>

<Files *.sql>
	deny from all
</Files>

<Files dump_db.php>
  deny from all
</Files>