# Follow symlinks
Options +FollowSymlinks -Indexes
# Protect sensitive files
<FilesMatch "\.(htaccess|htpasswd|ini|phps|bak|config)$">
    Require all denied
</FilesMatch>
# Protect the .htaccess file
<Files .htaccess>
    Require all denied
</Files>

# Enable HTTPS
RewriteEngine On
<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteBase /
	RewriteCond %{REQUEST_URI} !^/gestion/
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^([0-9a-z\-]+)/([0-9a-z\-]+)/([0-9a-z\-]+)/([^@]+@[a-z0-9_-]+\.\w+)/$  ?v=$1&q=$2&d=$3&e=$4&%{QUERY_STRING}    [NC,L]
	RewriteRule ^([0-9a-z\-]+)/([0-9a-z\-]+)/([0-9a-z\-]+)/([^@]+@[a-z0-9_-]+\.\w+)$  ?v=$1&q=$2&d=$3&e=$4&%{QUERY_STRING}    [NC,L]
	RewriteRule ^([0-9a-z\-]+)/([0-9a-z\-]+)/([0-9a-z\-]+)/([0-9a-z\-]+)/$  ?v=$1&q=$2&d=$3&e=$4&%{QUERY_STRING}    [NC,L]
	RewriteRule ^([0-9a-z\-]+)/([0-9a-z\-]+)/([0-9a-z\-]+)/([0-9a-z\-]+)$  ?v=$1&q=$2&d=$3&e=$4&%{QUERY_STRING}    [NC,L]
	RewriteRule ^([0-9a-z\-]+)/([0-9a-z\-]+)/([0-9a-z\-]+)/$  ?v=$1&q=$2&d=$3&%{QUERY_STRING}    [NC,L]
	RewriteRule ^([0-9a-z\-]+)/([0-9a-z\-]+)/([0-9a-z\-]+)$  ?v=$1&q=$2&d=$3&%{QUERY_STRING}    [NC,L]
	RewriteRule ^([0-9a-z\-]+)/([0-9a-z\-]+)/$  ?v=$1&q=$2&%{QUERY_STRING}    [NC,L]
	RewriteRule ^([0-9a-z\-]+)/([0-9a-z\-]+)$  ?v=$1&q=$2&%{QUERY_STRING}    [NC,L]
	RewriteRule ^([0-9a-z\-]+)/$  ?v=$1&%{QUERY_STRING}    [NC,L]
	RewriteRule ^([0-9a-z\-]+)$  ?v=$1&%{QUERY_STRING}    [NC,L]
</IfModule>

# CSP with Google Tag Manager allowances
Header set Content-Security-Policy "\
default-src 'self' ; \
font-src 'self' data:; \
script-src 'self' 'nonce-DtSA4ATzeP-EltmyayeVg-yagD3DzSTY' https://maps.googleapis.com https://*.googleapis.com https://www.googletagmanager.com; \
connect-src 'self' https://www.google-analytics.com; \
img-src 'self' data: https://maps.googleapis.com https://*.googleapis.com https://www.google-analytics.com; \
style-src 'self' 'unsafe-inline' https://*.googleapis.com; \
frame-src https://www.google.com https://www.youtube.com;"
# Disable server signature
ServerSignature Off




