image-heberg/.htaccess

52 lines
No EOL
1.8 KiB
ApacheConf

#/*
#* Copyright 2008-2017 Anael Mobilia
#*
#* This file is part of image-heberg.fr.
#*
#* image-heberg.fr is free software: you can redistribute it and/or modify
#* it under the terms of the GNU General Public License as published by
#* the Free Software Foundation, either version 3 of the License, or
#* (at your option) any later version.
#*
#* image-heberg.fr is distributed in the hope that it will be useful,
#* but WITHOUT ANY WARRANTY; without even the implied warranty of
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#* GNU General Public License for more details.
#*
#* You should have received a copy of the GNU General Public License
#* along with image-heberg.fr. If not, see <http://www.gnu.org/licenses/>
#*/
# Interdiction de lister le contenu des répertoires
Options -Indexes
# Ré-écriture d'URL
RewriteEngine On
# Redirection systématique - si requise - vers www.image-heberg.fr
# HTTPS
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} image-heberg\.fr\.cr [NC,OR]
RewriteCond %{HTTP_HOST} ^image-heberg\.fr [NC]
RewriteRule (.*) https://www.image-heberg.fr/$1 [R=301,L,NE]
# HTTP
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} image-heberg\.fr\.cr [NC,OR]
RewriteCond %{HTTP_HOST} ^image-heberg\.fr [NC]
RewriteRule (.*) https://www.image-heberg.fr/$1 [R=301,L,NE]
# Protection des répertoires classes, config, __tests, includes
RewriteCond %{REQUEST_URI} ^/classes/ [OR]
RewriteCond %{REQUEST_URI} ^/config/ [OR]
RewriteCond %{REQUEST_URI} ^/__tests/ [OR]
RewriteCond %{REQUEST_URI} ^/includes/
RewriteRule .* - [F]
# Images : redirection pour affichage
RewriteCond %{REQUEST_URI} ^/files/
RewriteRule .* displayPics.php [END]
# HTTPS obligatoire pour le site (hors affichage image)
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/files/
RewriteRule (.*) https://www.image-heberg.fr/$1 [R=301,L,NE]