htaccess fixe

This commit is contained in:
Bachir Soussi Chiadmi 2015-11-24 12:47:26 +01:00
parent 5e099d48de
commit 7c51b255fb

165
.htaccess
View File

@ -3,7 +3,7 @@
# #
# Protect files and directories from prying eyes. # Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$"> <FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
Order allow,deny Order allow,deny
</FilesMatch> </FilesMatch>
@ -20,7 +20,7 @@ ErrorDocument 404 /index.php
DirectoryIndex index.php index.html index.htm DirectoryIndex index.php index.html index.htm
# Override PHP settings that cannot be changed at runtime. See # Override PHP settings that cannot be changed at runtime. See
# sites/default/default.settings.php and drupal_initialize_variables() in # sites/default/default.settings.php and drupal_environment_initialize() in
# includes/bootstrap.inc for settings that can be changed at runtime. # includes/bootstrap.inc for settings that can be changed at runtime.
# PHP 5, Apache 1 and 2. # PHP 5, Apache 1 and 2.
@ -56,6 +56,17 @@ DirectoryIndex index.php index.html index.htm
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
RewriteEngine on RewriteEngine on
# Set "protossl" to "s" if we were accessed via https://. This is used later
# if you enable "www." stripping or enforcement, in order to ensure that
# you don't bounce between http and https.
RewriteRule ^ - [E=protossl]
RewriteCond %{HTTPS} on
RewriteRule ^ - [E=protossl:s]
# Make sure Authorization HTTP header is available to PHP
# even when running as CGI or FastCGI.
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Block access to "hidden" directories whose names begin with a period. This # Block access to "hidden" directories whose names begin with a period. This
# includes directories used by version control systems such as Subversion or # includes directories used by version control systems such as Subversion or
# Git to store control files. Files whose names begin with a period, as well # Git to store control files. Files whose names begin with a period, as well
@ -71,23 +82,6 @@ DirectoryIndex index.php index.html index.htm
# downloaded. # downloaded.
RewriteRule "(^|/)\." - [F] RewriteRule "(^|/)\." - [F]
# redirect all materiau domains to materio.com
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^basebeta\.materio\.com [OR]
RewriteCond %{HTTP_HOST} ^materio\.com [OR]
RewriteCond %{HTTP_HOST} ^www\.materio\.fr [OR]
RewriteCond %{HTTP_HOST} ^materio\.fr [OR]
RewriteCond %{HTTP_HOST} ^www\.materio\.net [OR]
RewriteCond %{HTTP_HOST} ^materio\.net [OR]
RewriteCond %{HTTP_HOST} ^www\.materio\.eu [OR]
RewriteCond %{HTTP_HOST} ^materio\.eu
RewriteRule ^ http://www.materio.com%{REQUEST_URI} [L,R=301]
# SSL
# RewriteCond %{HTTPS} off [OR]
# RewriteCond %{HTTP_HOST} ^www.materio\.com*
# RewriteRule ^(.*)$ https://materio.com/$1 [L,R=301]
# If your site can be accessed both with and without the 'www.' prefix, you # If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred # can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option: # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
@ -95,14 +89,15 @@ DirectoryIndex index.php index.html index.htm
# To redirect all users to access the site WITH the 'www.' prefix, # To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...) # (http://example.com/... will be redirected to http://www.example.com/...)
# uncomment the following: # uncomment the following:
# RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} .
# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# #
# To redirect all users to access the site WITHOUT the 'www.' prefix, # To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...) # (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment the following: # uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301] # RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly. # VirtualDocumentRoot and the rewrite rules are not working properly.
@ -121,22 +116,24 @@ DirectoryIndex index.php index.html index.htm
RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L] RewriteRule ^ index.php [L]
## local # CUSTOMS
# RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1 # redirect all materiau domains to materio.com
## maison quentin # RewriteCond %{HTTPS} off
# RewriteCond %{REMOTE_ADDR} !^86\.68\.188\.175 # RewriteCond %{HTTP_HOST} ^basebeta\.materio\.com [OR]
## materio # RewriteCond %{HTTP_HOST} ^materio\.com [OR]
# RewriteCond %{REMOTE_ADDR} !^212\.198\.136\.215 # RewriteCond %{HTTP_HOST} ^www\.materio\.fr [OR]
## maison bach # RewriteCond %{HTTP_HOST} ^materio\.fr [OR]
# RewriteCond %{REMOTE_ADDR} !^82\.230\.62\.145 # RewriteCond %{HTTP_HOST} ^www\.materio\.net [OR]
# RewriteRule !maintenance http://www.materio.com/maintenance [L,R=302,E=nocache:1] # RewriteCond %{HTTP_HOST} ^materio\.net [OR]
# RewriteCond %{HTTP_HOST} ^www\.materio\.eu [OR]
# RewriteCond %{HTTP_HOST} ^materio\.eu
# RewriteRule ^ http://www.materio.com%{REQUEST_URI} [L,R=301]
# SSL
# RewriteCond %{HTTPS} off [OR]
# RewriteCond %{HTTP_HOST} ^www.materio\.com*
# RewriteRule ^(.*)$ https://materio.com/$1 [L,R=301]
## http://mark.koli.ch/2010/12/set-cache-control-and-expires-headers-on-a-redirect-with-mod-rewrite.html
## Set the response header if the "nocache" environment variable is set
## in the RewriteRule above.
# Header always set Cache-Control "no-store, no-cache, must-revalidate" env=nocache
## Set Expires too ...
# Header always set Expires "Thu, 01 Jan 1970 00:00:00 GMT" env=nocache
# Rules to correctly serve gzip compressed CSS and JS files. # Rules to correctly serve gzip compressed CSS and JS files.
@ -165,94 +162,8 @@ DirectoryIndex index.php index.html index.htm
</IfModule> </IfModule>
</IfModule> </IfModule>
# Add headers to all responses.
<IfModule mod_headers.c>
# FROM Html5 BoilerPlate 4.0 # Disable content sniffing, since it's an attack vector.
Header always set X-Content-Type-Options nosniff
# ----------------------------------------------------------------------
# Proper MIME type for all files
# ----------------------------------------------------------------------
# JavaScript
# Normalize to standard type (it's sniffed in IE anyways)
# tools.ietf.org/html/rfc4329#section-7.2
AddType application/javascript js jsonp
AddType application/json json
# Audio
AddType audio/ogg oga ogg
AddType audio/mp4 m4a f4a f4b
# Video
AddType video/ogg ogv
AddType video/mp4 mp4 m4v f4v f4p
AddType video/webm webm
AddType video/x-flv flv
# SVG
# Required for svg webfonts on iPad
# twitter.com/FontSquirrel/status/14855840545
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
# Webfonts
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttf ttc
AddType font/opentype otf
AddType application/x-font-woff woff
# Assorted types
AddType image/x-icon ico
AddType image/webp webp
AddType text/cache-manifest appcache manifest
AddType text/x-component htc
AddType application/xml rss atom xml rdf
AddType application/x-chrome-extension crx
AddType application/x-opera-extension oex
AddType application/x-xpinstall xpi
AddType application/octet-stream safariextz
AddType application/x-web-app-manifest+json webapp
AddType text/x-vcard vcf
AddType application/x-shockwave-flash swf
AddType text/vtt vtt
# ----------------------------------------------------------------------
# UTF-8 encoding
# ----------------------------------------------------------------------
# Use UTF-8 encoding for anything served text/plain or text/html
AddDefaultCharset utf-8
# Force UTF-8 for a number of file formats
AddCharset utf-8 .atom .css .js .json .rss .vtt .xml
# ----------------------------------------------------------------------
# A little more security
# ----------------------------------------------------------------------
# Block access to "hidden" directories or files whose names begin with a
# period. This includes directories used by version control systems such as
# Subversion or Git.
<IfModule mod_rewrite.c>
RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule "(^|/)\." - [F]
</IfModule>
# Block access to backup and source files. These files may be left by some
# text/html editors and pose a great security danger, when anyone can access
# them.
<FilesMatch "(\.(bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
# Increase cookie security
<IfModule php5_module>
php_value session.cookie_httponly true
</IfModule> </IfModule>