<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Naeh.net &#187; htaccess</title>
	<atom:link href="http://naeh.net/tag/htaccess/feed/" rel="self" type="application/rss+xml" />
	<link>http://naeh.net</link>
	<description>Le mémo du développeur</description>
	<lastBuildDate>Thu, 09 Sep 2010 15:30:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>protéger un ou plusieurs fichiers par htaccess</title>
		<link>http://naeh.net/proteger-un-ou-plusieurs-fichiers-par-htaccess/</link>
		<comments>http://naeh.net/proteger-un-ou-plusieurs-fichiers-par-htaccess/#comments</comments>
		<pubDate>Fri, 08 May 2009 16:46:23 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Divers]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[htaccess]]></category>

		<guid isPermaLink="false">http://naeh.net/?p=95</guid>
		<description><![CDATA[Nous avons vu dans précédent article comment protéger un répertoire avec htaccess, c'est l'utilisation la plus courante de cette technique, mais ici nous allons nous intéresser a comment faire la même chose mais pour protéger uniquement un ou quelques fichiers d'un répertoire, c'est à dire, dans le même répertoire, certains fichiers seront protégés mais pas [...]]]></description>
			<content:encoded><![CDATA[<p>Nous avons vu dans <a href="http://naeh.net/proteger-un-repertoire-par-un-htaccess/">précédent article</a> comment protéger un répertoire avec htaccess, c'est l'utilisation la plus courante de cette technique, mais ici nous allons nous intéresser a comment faire la même chose mais pour protéger uniquement un ou quelques fichiers d'un répertoire, c'est à dire, dans le même répertoire, certains fichiers seront protégés mais pas d'autres.</p>
<p>pour protéger un seul fichier voici ce qu'il faut mettre dans le .htaccess :</p>

<div class="wp_codebox"><table><tr id="p953"><td class="code" id="p95code3"><pre class="html" style="font-family:monospace;">&lt;Files fichier.ext&gt;
require valid-user
&lt;/Files&gt;</pre></td></tr></table></div>

<p>pour en protéger plusieurs :</p>

<div class="wp_codebox"><table><tr id="p954"><td class="code" id="p95code4"><pre class="html" style="font-family:monospace;">&lt;Files fichier1.ext fichier2.ext fichier3.ext&gt;
require valid-user
&lt;/Files&gt;</pre></td></tr></table></div>

<p>cette syntaxe est a utiliser en complément de celle expliquée dans <a href="http://naeh.net/proteger-un-repertoire-par-un-htaccess">l'autre article</a> bien sûr.</p>
<p>bonne protection de fichiers...</p>
]]></content:encoded>
			<wfw:commentRss>http://naeh.net/proteger-un-ou-plusieurs-fichiers-par-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protéger un répertoire par htaccess</title>
		<link>http://naeh.net/proteger-un-repertoire-par-un-htaccess/</link>
		<comments>http://naeh.net/proteger-un-repertoire-par-un-htaccess/#comments</comments>
		<pubDate>Mon, 10 Mar 2008 23:18:34 +0000</pubDate>
		<dc:creator>Naeh</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Serveur]]></category>
		<category><![CDATA[vhost]]></category>

		<guid isPermaLink="false">http://naeh.net/proteger-un-repertoire-par-un-htaccess/</guid>
		<description><![CDATA[Le but de cet article est montrer comment protéger un répertoire par un htaccess.
pour cela il faut d'abord créer un fichier .htaccess à la racine du répertoire, ce fichier doit contenir  les lignes suivantes (a adapter selon la configuration/ besoins) :

AuthName &#34;Page protégée&#34;
AuthType Basic
AuthUserFile &#34;/CHEMIN/VERS/LE/FICHIER/.htpasswd&#34;
Require valid-user

en suite il faut créer un fichier .htpasswd qui [...]]]></description>
			<content:encoded><![CDATA[<p>Le but de cet article est montrer comment protéger un répertoire par un <strong>htaccess</strong>.</p>
<p>pour cela il faut d'abord créer un fichier <em>.htaccess</em> à la racine du répertoire, ce fichier doit contenir  les lignes suivantes (a adapter selon la configuration/ besoins) :</p>

<div class="wp_codebox"><table><tr id="p488"><td class="code" id="p48code8"><pre class="bash" style="font-family:monospace;">AuthName <span style="color: #ff0000;">&quot;Page protégée&quot;</span>
AuthType Basic
AuthUserFile <span style="color: #ff0000;">&quot;/CHEMIN/VERS/LE/FICHIER/.htpasswd&quot;</span>
Require valid-user</pre></td></tr></table></div>

<p>en suite il faut créer un fichier <em>.htpasswd</em> qui lui contiendra les couples login/mot de passe qui auront accès au répertoire protégé.<br />
pour cela exécutez la commande suivante :</p>

<div class="wp_codebox"><table><tr id="p489"><td class="code" id="p48code9"><pre class="bash" style="font-family:monospace;">htpasswd <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">/</span>CHEMIN<span style="color: #000000; font-weight: bold;">/</span>VERS<span style="color: #000000; font-weight: bold;">/</span>LE<span style="color: #000000; font-weight: bold;">/</span>FICHIER<span style="color: #000000; font-weight: bold;">/</span>.htpasswd LOGIN</pre></td></tr></table></div>

<p>-c pour créer un nouveau fichier <em>.htpasswd</em> (a ne pas utiliser si vous ajouter un utilisateur à un fichier existant).<br />
il vous sera ensuite demandé d'entrer le mot de passe 2 fois, faites le, et le tour est joué.</p>
<p>pour plus de renseignement sur la commande <strong>htpasswd</strong>, voici l'écran d'aide de ladite commande :</p>

<div class="wp_codebox"><table><tr id="p4810"><td class="code" id="p48code10"><pre class="bash" style="font-family:monospace;">$ htpasswd
Usage:
        htpasswd <span style="color: #7a0874; font-weight: bold;">&#91;</span>-cmdpsD<span style="color: #7a0874; font-weight: bold;">&#93;</span> passwordfile username
        htpasswd -b<span style="color: #7a0874; font-weight: bold;">&#91;</span>cmdpsD<span style="color: #7a0874; font-weight: bold;">&#93;</span> passwordfile username password
        htpasswd -n<span style="color: #7a0874; font-weight: bold;">&#91;</span>mdps<span style="color: #7a0874; font-weight: bold;">&#93;</span> username
        htpasswd -nb<span style="color: #7a0874; font-weight: bold;">&#91;</span>mdps<span style="color: #7a0874; font-weight: bold;">&#93;</span> username password
&nbsp;
 <span style="color: #660033;">-c</span>  Create a new file.
 <span style="color: #660033;">-n</span>  Don<span style="color: #ff0000;">'t update file; display results on stdout.
 -m  Force MD5 encryption of the password.
 -d  Force CRYPT encryption of the password (default).
 -p  Do not encrypt the password (plaintext).
 -s  Force SHA encryption of the password.
 -b  Use the password from the command line rather than prompting for it.
 -D  Delete the specified user.
On Windows, NetWare and TPF systems the '</span><span style="color: #660033;">-m</span><span style="color: #ff0000;">' flag is used by default.
On all other systems, the '</span><span style="color: #660033;">-p</span><span style="color: #ff0000;">' flag will probably not work.</span></pre></td></tr></table></div>

<p>notez aussi que pour que cette protection fonctionne, il est obligatoire de ne pas avoir la directive apache <strong>AllowOverride</strong> a none, sinon le fichier <em>.htaccess</em> ne sera pas pris en compte, donc n'oubliez pas de la commenter ou l'enlever tout simplement si vous l'avez dans votre <strong>vhost</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://naeh.net/proteger-un-repertoire-par-un-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
