====== Fichiers .htaccess ====== **Redirections :** [[webdev:redirections|Redirections de pages]] [[https://gtmetrix.com/add-expires-headers.html]] [[http://www.seomix.fr/guide-htaccess-performances-et-temps-de-chargement/]] ===== .htpasswd ===== Déposer ce fichier sur le serveur et récupérer ce qu'il écrit Générer un fichier .htpasswd : [[http://www.htaccesstools.com/htpasswd-generator/]] # Protection .htpasswd AuthName "Site protégé" AuthType Basic AuthUserFile "/home/www/clients/client1/web23/web/.htpasswd" Require valid-user ==== Removing controls in subdirectories ==== [[https://httpd.apache.org/docs/2.2/mod/core.html#require|Doc]] The following example shows how to use the Satisfy directive to disable access controls in a subdirectory of a protected directory. This technique should be used with caution, because it will also disable any access controls imposed by mod_authz_host. Require user david # All access controls and authentication are disabled # in this directory Satisfy Any Allow from all ===== Dire aux moteurs de recherche de désindexer des documents ===== [[https://www.abondance.com/actualites/20130701-12840-desindexation-de-fichiers-pdf-bonne-ou-mauvaise-pratique.html|Infos]] #Bloquer l'indexation des fichiers Word et PDF Header set X-Robots-Tag "noindex, nofollow" ===== Bloquer l'accès à un fichier particulier ===== [[https://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectmatch|Ref Doc 1]] [[https://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule|2]] RedirectMatch 403 ^/.git/?$ RewriteRule ^.git/?$ - [F,L] RedirectMatch 403 ^/readme.md RewriteRule ^readme.md - [F,L] RedirectMatch 403 ^/dump.sql RewriteRule ^dump.sql - [F,L]