<IfModule mod_rewrite.c>

RewriteEngine On

## Begin RewriteBase
# If you are getting 500 or 404 errors on subpages, you may have to uncomment the RewriteBase entry
# You should change the '/' to your appropriate subfolder. For example if you have
# your Grav install at the root of your site '/' should work, else it might be something
# along the lines of: RewriteBase /<your_sub_folder>
##

  RewriteBase /

## End - RewriteBase

## Begin - X-Forwarded-Proto
# In some hosted or load balanced environments, SSL negotiation happens upstream.
# In order for Grav to recognize the connection as secure, you need to uncomment
# the following lines.
#
# RewriteCond %{HTTP:X-Forwarded-Proto} https
# RewriteRule .* - [E=HTTPS:on]
#
## End - X-Forwarded-Proto

## Begin - Exploits
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to Grav
#
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Exploits

## Begin - Index
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
## End - Index

## Begin - Security
# Block all direct access for these folders
RewriteRule ^(\.git|cache|bin|logs|backup|webserver-configs|tests)/(.*) error [F]
# Block access to specific file types for these system folders
RewriteRule ^(system|vendor)/(.*)\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ error [F]
# Block access to specific file types for these user folders
RewriteRule ^(user)/(.*)\.(txt|md|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ error [F]
# Block all direct access to .md files:
RewriteRule \.md$ error [F]
# Block all direct access to files and folders beginning with a dot
RewriteRule (^|/)\.(?!well-known) - [F]
# Block access to specific files in the root folder
RewriteRule ^(LICENSE\.txt|composer\.lock|composer\.json|\.htaccess)$ error [F]
## End - Security

</IfModule>

# Begin - Prevent Browsing and Set Default Resources
Options -Indexes
DirectoryIndex index.php index.html index.htm
# End - Prevent Browsing and Set Default Resources

## MISE EN CACHE DU NAVIGATEUR ##

# UN AN POUR LES IMAGES
<filesMatch ".(jpg|jpeg|png|gif|ico)$">
Header set Cache-Control "max-age=31536000, public"
</filesMatch>

# UN MOIS POUR LES SCRIPTS
<filesMatch ".(css|js)$">
Header set Cache-Control "max-age=2628000, public"
</filesMatch>

RewriteEngine On

RewriteRule ^﻿contacts\.html$ /qui-sommes-nous/le-campus [R=301,L]
RewriteRule ^la-journee-pedagogique-de-la-petite-enfance\.html$ /agenda [R=301,L]
RewriteRule ^stage-plantes-aromatiques-et-medicinales\.html$ /agenda/stage-plantes-aromatiques-and-medicinales [R=301,L]
RewriteRule ^prestations\.html$ /organisez-vos-evenements/salles [R=301,L]
RewriteRule ^equipements\.html$ /organisez-vos-evenements/salles [R=301,L]
RewriteRule ^inauguration-de-la-salle-drome-vendredi-27-avril-2018\.html$ /agenda [R=301,L]
RewriteRule ^les-visites-d-etudes\.html$ /organisez-vos-evenements/team-building [R=301,L]
RewriteRule ^les-controverses\.html$ /agenda [R=301,L]
RewriteRule ^nos-references\.html$ / [R=301,L]
RewriteRule ^l-ecosite\.html$ / [R=301,L]
RewriteRule ^acces-au-campus\.html$ / [R=301,L]
RewriteRule ^les-partenariats\.html$ / [R=301,L]
RewriteRule ^mentions-legales\.html$ /mentions-legales [R=301,L]
RewriteRule ^le-val-de-drome\.html$ / [R=301,L]
RewriteRule ^biovallee-le-campus\.html$ / [R=301,L]
RewriteRule ^acces\.html$ /qui-sommes-nous/plan-dacces [R=301,L]
RewriteRule ^contactez-nous\.html$ /qui-sommes-nous/plan-dacces [R=301,L]
RewriteRule ^politique-daccessibilite\.html$ /mentions-legales [R=301,L]
RewriteRule ^stage-aromatherapie-theorie-et-pratique-des-huiles-essentielles\.html$ /agenda/stage-aromatherapie-theorie-and-pratique-des-huiles-essentielles [R=301,L]
RewriteRule ^\?page_publication=2$ / [R=301,L]
RewriteRule ^\?page_publication=3$ / [R=301,L]
RewriteRule ^espace-presse\.html$ / [R=301,L]
RewriteRule ^les-controverses-un-debat-avec-michel-hery-et-philippe-fremeaux-sur-les-evolutions-du-monde-du-travail-face-a-la-numerisation\.html$ /archive [R=301,L]
RewriteRule ^credits\.html$ /credits [R=301,L]
RewriteRule ^ca-sest-passe-au-campus\.html$ /archive [R=301,L]
RewriteRule ^la-biovallee\.html$ / [R=301,L]
RewriteRule ^les-materiels-pedagogiques-adaptes-les-logiciels-et-outils-pour-les-dys\.html$ /archive [R=301,L]
RewriteRule ^ca-se-passe-au-campus\.html$ /archive [R=301,L]
RewriteRule ^les-controverses-du-campus-jeudi-4-mai-2017-pourquoi-legalite-est-meilleure-pour-tous\.html$ /archive [R=301,L]
RewriteRule ^notre-democratie-est-elle-aussi-malade-quon-le-dit\.html$ /archive [R=301,L]
RewriteRule ^formation-mieux-communiquer-pour-mieux-cooperer\.html$ /archive [R=301,L]
RewriteRule ^reseau-entreprendre-fetes-des-membres\.html$ /agenda/reseau-entreprendre-fetes-des-membres [R=301,L]
RewriteRule ^une-soiree-en-hommage-a-jean-marie-pelt-a-biovallee-le-campus\.html$ /archive [R=301,L]
RewriteRule ^decouvrir\.html$ / [R=301,L]
RewriteRule ^biovallee-territoire-ecole\.html$ / [R=301,L]
RewriteRule ^retour-sur-la-soiree-cooperer-et-creer-en-biovallee-8-mars-2018\.html$ /archive [R=301,L]
RewriteRule ^les-controverses-du-campus-le-modele-social-francais\.-faut-il-le-changer-le-casser-le-sauver\.html$ /archive [R=301,L]
RewriteRule ^stage-sante-aliments-microbiote\.html$ /agenda/stage-sante-aliments-microbiote [R=301,L]
RewriteRule ^conversations-carbone\.html$ /archive [R=301,L]
RewriteRule ^le-materiel\.html$ /organisez-vos-evenements/salles [R=301,L]
RewriteRule ^les-salles\.html$ /organisez-vos-evenements/salles [R=301,L]
RewriteRule ^compostage-collectif-sur-le-territoire-temoignages-croises-sur-lantenne-de-rdwa\.html$ /agenda/compostage-collectif-sur-le-territoire-temoignages-croises-sur-l%27antenne-de-rdwa [R=301,L]
RewriteRule ^les-controverses-du-campus-vive-la-croissance-oui-mais-laquelle-pourquoi-et-pour-qui\.html$ /archive [R=301,L]
RewriteRule ^louis-gallois-presente-un-territoire-zero-chomeur-de-longue-duree\.html$ /archive [R=301,L]
RewriteRule ^le-1er-petit-dejeuner-du-developpement-durable-organise-par-lassociation-des-acteurs-de-biovallee\.html$ /agenda/le_1er_petit_dejeuner_du_developpement_durable [R=301,L]
RewriteRule ^organiser\.html$ /organisez-vos-evenements/salles [R=301,L]
RewriteRule ^la-ccvd-signe-une-convention-de-partenariat-avec-la-communaute-universite-grenoble-alpes\.html$ /archive [R=301,L]
RewriteRule ^ca-sest-passe-au-campus\.html\?page_actu=2$ /archive [R=301,L]
RewriteRule ^ca-sest-passe-au-campus\.html\?page_actu=3$ /archive [R=301,L]
RewriteRule ^48-stagiaires-en-creationreprise-dentreprises-accueillis-a-lhotel-de-formation-biovallee-le-campus\.html$ /archive [R=301,L]
RewriteRule ^la-fol-26-fete-ses-90-ans-sur-lecosite-du-val-de-drome\.html$ /archive [R=301,L]
RewriteRule ^partenariat-avec-la-communaute-universite-grenoble-alpes\.html$ /archive [R=301,L]
RewriteRule ^deux-journalistes-recompensees-par-le-club-de-la-presse\.html$ /archive [R=301,L]
RewriteRule ^cirh3\.html$ /archive [R=301,L]
RewriteRule ^seminaire-plan-national-dactions-en-faveur-de-lapron-du-rhone-bilan-de-5-annees-de-travail\.html$ /archive [R=301,L]
RewriteRule ^jean-jouzel-un-prix-nobel-en-biovallee-15-juin-2017\.html$ /archive [R=301,L]
RewriteRule ^40-chefs-dentreprises-developpent-du-chiffre-daffaires-a-biovallee-le-campus\.html$ /archive [R=301,L]
RewriteRule ^la-lpo-coordination-auvergne-rhone-alpes-en-biovallee-pour-son-assemblee-generale-24-juin-2017\.html$ /agenda/la-lpo-coordination-auvergne-rhone-alpes-en-biovallee-pour-son-assemblee-generale-24-juin-2017 [R=301,L]
RewriteRule ^economie-ca-bouge-pas-mal-2\.html$ /archive [R=301,L]
RewriteRule ^le-pole-agro-ecologique-en-biovallee-forme-de-jeunes-agriculteurs-22-juin-2017\.html$ /archive [R=301,L]
RewriteRule ^de-la-musique-a-la-citoyennete-un-orchestre-a-lecole\.html$ /agenda/de-la-musique-a-la-citoyennete-un-orchestre-a-lecole [R=301,L]
