9ecf04e1256ba153c86e74edb77cfd705c55a042nd<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<html xmlns="http://www.w3.org/1999/xhtml" lang="pt-br" xml:lang="pt-br"><head>
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
9ecf04e1256ba153c86e74edb77cfd705c55a042nd XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
9ecf04e1256ba153c86e74edb77cfd705c55a042nd This file is generated from xml source: DO NOT EDIT
9ecf04e1256ba153c86e74edb77cfd705c55a042nd XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc<title>Tutorial do Apache: arquivos .htaccess - Servidor HTTP Apache Vers�o 2.5</title>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
2e545ce2450a9953665f701bb05350f0d3f26275nd<script src="/style/scripts/prettify.min.js" type="text/javascript">
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<link href="/images/favicon.ico" rel="shortcut icon" /></head>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<p class="menu"><a href="/mod/">M�dulos</a> | <a href="/mod/quickreference.html">Diretrizes</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Gloss�rio</a> | <a href="/sitemap.html">Mapa do site</a></p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">Servidor HTTP</a> > <a href="http://httpd.apache.org/docs/">Documenta��o</a> > <a href="../">Vers�o 2.5</a> > <a href="./">How-To / Tutoriais</a></div><div id="page-content"><div id="preamble"><h1>Tutorial do Apache: arquivos .htaccess</h1>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<p><span>L�nguas Dispon�veis: </span><a href="/en/howto/htaccess.html" hreflang="en" rel="alternate" title="English"> en </a> |
c04f76acce77126cf88b09350e56ea8c6b4a064enilgun<a href="/fr/howto/htaccess.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> |
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<a href="/ja/howto/htaccess.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<a href="/ko/howto/htaccess.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<a href="/pt-br/howto/htaccess.html" title="Portugu�s (Brasil)"> pt-br </a></p>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf<div class="outofdate">Esta tradu��o pode estar desatualizada.
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem Confira a vers�o em Ingl�s para mudan�as recentes.</div>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<p>Arquivos <code>.htaccess</code> oferecem um meio de fazer mudan�as
9ecf04e1256ba153c86e74edb77cfd705c55a042nd nas configura��es por-diret�rio.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#related">Arquivos .htaccess </a></li>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<li><img alt="" src="/images/down.gif" /> <a href="#what">O que eles s�o/Como us�-los</a></li>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<li><img alt="" src="/images/down.gif" /> <a href="#when">Quando (n�o) usar arquivos .htaccess</a></li>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<li><img alt="" src="/images/down.gif" /> <a href="#how">Como as diretrizes s�o aplicadas</a></li>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<li><img alt="" src="/images/down.gif" /> <a href="#auth">Exemplo de Autentica��o</a></li>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<li><img alt="" src="/images/down.gif" /> <a href="#ssi">Exemplo de Server Side Includes</a></li>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<li><img alt="" src="/images/down.gif" /> <a href="#cgi">Exemplo de CGI</a></li>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<li><img alt="" src="/images/down.gif" /> <a href="#troubleshoot">Resolvendo Problemas</a></li>
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh</ul><ul class="seealso"><li><a href="#comments_section">Coment�rios</a></li></ul></div>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<h2><a name="related" id="related">Arquivos .htaccess </a></h2>
f5a398cc8880978754903f9ece8e4beb63a81cedrbowen <table class="related"><tr><th>M�dulos Relacionados</th><th>Diretrizes Relacionadas</th></tr><tr><td><ul><li><code class="module"><a href="/mod/core.html">core</a></code></li><li><code class="module"><a href="/mod/mod_authn_file.html">mod_authn_file</a></code></li><li><code class="module"><a href="/mod/mod_authz_groupfile.html">mod_authz_groupfile</a></code></li><li><code class="module"><a href="/mod/mod_cgi.html">mod_cgi</a></code></li><li><code class="module"><a href="/mod/mod_include.html">mod_include</a></code></li><li><code class="module"><a href="/mod/mod_mime.html">mod_mime</a></code></li></ul></td><td><ul><li><code class="directive"><a href="/mod/core.html#accessfilename">AccessFileName</a></code></li><li><code class="directive"><a href="/mod/core.html#allowoverride">AllowOverride</a></code></li><li><code class="directive"><a href="/mod/core.html#options">Options</a></code></li><li><code class="directive"><a href="/mod/mod_mime.html#addhandler">AddHandler</a></code></li><li><code class="directive"><a href="/mod/core.html#sethandler">SetHandler</a></code></li><li><code class="directive"><a href="/mod/mod_authn_core.html#authtype">AuthType</a></code></li><li><code class="directive"><a href="/mod/mod_authn_core.html#authname">AuthName</a></code></li><li><code class="directive"><a href="/mod/mod_authn_file.html#authuserfile">AuthUserFile</a></code></li><li><code class="directive"><a href="/mod/mod_authz_groupfile.html#authgroupfile">AuthGroupFile</a></code></li><li><code class="directive"><a href="/mod/mod_authz_core.html#require">Require</a></code></li></ul></td></tr></table>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<h2><a name="what" id="what">O que eles s�o/Como us�-los</a></h2>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd configura��o distribu�da") oferecem um meio de fazer mudan�as nas
9ecf04e1256ba153c86e74edb77cfd705c55a042nd configura��es por-diret�rio. Um arquivo, contendo uma ou mais
9ecf04e1256ba153c86e74edb77cfd705c55a042nd diretrizes de configura��es, � colocado em um diret�rio
9ecf04e1256ba153c86e74edb77cfd705c55a042nd em particular, e as diretrizes se aplicam para aquele diret�rio e todos
9ecf04e1256ba153c86e74edb77cfd705c55a042nd os seu subdiret�rios subseq�entes.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Se voc� quiser renomear o seu arquivo <code>.htaccess</code>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd para outro nome, voc� deve usar a diretriz <code class="directive"><a href="/mod/core.html#accessfilename">AccessFileName</a></code>. Por exemplo, se voc�
9ecf04e1256ba153c86e74edb77cfd705c55a042nd prefere que o arquivo se chame <code>.config</code>, ent�o voc�
9ecf04e1256ba153c86e74edb77cfd705c55a042nd pode adicionar a seguinte linha ao seu arquivo de configura��o
9ecf04e1256ba153c86e74edb77cfd705c55a042nd do servidor:</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd AccessFileName .config
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>No geral, arquivos <code>.htaccess</code> usam a mesma sintaxe
9ecf04e1256ba153c86e74edb77cfd705c55a042nd configura��o principal</a>. O que voc� pode colocar nesses
9ecf04e1256ba153c86e74edb77cfd705c55a042nd arquivos � determinado pele diretriz <code class="directive"><a href="/mod/core.html#allowoverride">AllowOverride</a></code>. Essa diretriz especifica,
9ecf04e1256ba153c86e74edb77cfd705c55a042nd em categorias, quais diretrizes ser�o aceitas caso sejam
9ecf04e1256ba153c86e74edb77cfd705c55a042nd encontradas em um arquivo <code>.htaccess</code>. Se uma diretriz
9ecf04e1256ba153c86e74edb77cfd705c55a042nd for permitida em um arquivo <code>.htaccess</code>, a documenta��o
9ecf04e1256ba153c86e74edb77cfd705c55a042nd para essa diretriz ir� conter uma se��o <em>Override</em>,
9ecf04e1256ba153c86e74edb77cfd705c55a042nd especificando que valor precisa estar em <code class="directive"><a href="/mod/core.html#allowoverride">AllowOverride</a></code> para que esta diretriz
9ecf04e1256ba153c86e74edb77cfd705c55a042nd seja permitida.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Por exemplo, se voc� procurar na documenta��o pela diretriz
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <code class="directive"><a href="/mod/core.html#adddefaultcharset">AddDefaultCharset</a></code>, voc�
9ecf04e1256ba153c86e74edb77cfd705c55a042nd achar� que ela � permitida nos arquivos <code>.htaccess</code>.
9ecf04e1256ba153c86e74edb77cfd705c55a042nd (Veja a linha Contexto no sum�rio das diretivas.) A
9ecf04e1256ba153c86e74edb77cfd705c55a042nd linha <a href="/mod/directive-dict.html#Context">Override</a> l�
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <code>AllowOverride FileInfo</code> para que essa diretriz seja
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <td><a href="/mod/directive-dict.html#Context">Contexto:</a></td>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <td>configura��o do servidor, hospedeiros virtuais, diret�rio, .htaccess</td>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <td><a href="/mod/directive-dict.html#Override">Override:</a></td>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Se voc� estiver incerto se uma diretriz em particular �
9ecf04e1256ba153c86e74edb77cfd705c55a042nd documenta��o por essa diretriz, e verifique a linha de
9ecf04e1256ba153c86e74edb77cfd705c55a042nd Contexto por ".htaccess".</p> </div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<h2><a name="when" id="when">Quando (n�o) usar arquivos .htaccess</a></h2>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>No geral, voc� nunca deve usar arquivos <code>.htaccess</code>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd a n�o ser que voc� n�o tenha acesso ao arquivo de configura��o
9ecf04e1256ba153c86e74edb77cfd705c55a042nd principal do servidor. Existe, por exemplo, um erro de concep��o
9ecf04e1256ba153c86e74edb77cfd705c55a042nd que dita que a autentica��o de usu�rios sempre deve
9ecf04e1256ba153c86e74edb77cfd705c55a042nd ser feita usando os arquivos <code>.htaccess</code>. Esse
9ecf04e1256ba153c86e74edb77cfd705c55a042nd simplesmente n�o � o caso. Voc� pode usar as configura��es de
9ecf04e1256ba153c86e74edb77cfd705c55a042nd autentica��o de usu�rio no arquivo de configura��o principal do
9ecf04e1256ba153c86e74edb77cfd705c55a042nd servidor, e isso �, de fato, a maneira mais adequada de se fazer
9ecf04e1256ba153c86e74edb77cfd705c55a042nd as coisas.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Arquivos <code>.htaccess</code> devem ser usados em casos onde
9ecf04e1256ba153c86e74edb77cfd705c55a042nd os provedores de conte�do do site precisem fazer mudan�as na
9ecf04e1256ba153c86e74edb77cfd705c55a042nd configura��o do servidor por-diret�rio, mas n�o tem
9ecf04e1256ba153c86e74edb77cfd705c55a042nd acesso <em>root</em> ao sistema do servidor. Caso o administrador do
9ecf04e1256ba153c86e74edb77cfd705c55a042nd servidor n�o esteja disposto a fazer mudan�as freq�entes nas
9ecf04e1256ba153c86e74edb77cfd705c55a042nd configura��es do servidor, � desej�vel permitir que os
9ecf04e1256ba153c86e74edb77cfd705c55a042nd usu�rios possam fazer essas mudan�as atrav�s de arquivos
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <code>.htaccess</code> eles mesmos. Isso � particularmente
9ecf04e1256ba153c86e74edb77cfd705c55a042nd verdade, por exemplo, em casos onde provedores est�o fornecendo
9ecf04e1256ba153c86e74edb77cfd705c55a042nd m�ltiplos sites para usu�rios em apenas uma m�quina, e querem que
9ecf04e1256ba153c86e74edb77cfd705c55a042nd seus usu�rios possam alterar suas configura��es.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>No entanto, de modo geral, o uso de arquivos <code>.htaccess</code>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd deve ser evitado quando poss�vel. Quaisquer configura��es
9ecf04e1256ba153c86e74edb77cfd705c55a042nd que voc� considerar acrescentar em um arquivo <code>.htaccess</code>, podem
9ecf04e1256ba153c86e74edb77cfd705c55a042nd ser efetivamente colocadas em uma se��o <code class="directive"><a href="/mod/core.html#directory"><Directory></a></code> no arquivo principal de
9ecf04e1256ba153c86e74edb77cfd705c55a042nd configura��o de seu servidor.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Existem duas raz�es principais para evitar o uso de arquivos
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>A primeira delas � a performance. Quando <code class="directive"><a href="/mod/core.html#allowoverride">AllowOverride</a></code> � configurado para
9ecf04e1256ba153c86e74edb77cfd705c55a042nd permitir o uso de arquivos <code>.htaccess</code>, o Apache procura
9ecf04e1256ba153c86e74edb77cfd705c55a042nd Logo, permitir arquivos <code>.htaccess</code> causa um impacto na
9ecf04e1256ba153c86e74edb77cfd705c55a042nd performance, mesmo sem voc� us�-los de fato! Al�m disso,
9ecf04e1256ba153c86e74edb77cfd705c55a042nd o arquivo <code>.htaccess</code> � carregado toda vez que um documento
9ecf04e1256ba153c86e74edb77cfd705c55a042nd � requerido.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Al�m disso, note que o Apache precisa procurar pelos arquivos
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <code>.htaccess</code> em todos os diret�rios superiores, para ter
9ecf04e1256ba153c86e74edb77cfd705c55a042nd o complemento total de todas as diretivas que devem ser
9ecf04e1256ba153c86e74edb77cfd705c55a042nd aplicadas. (Veja a se��o <a href="#how">como as diretrizes s�o
9ecf04e1256ba153c86e74edb77cfd705c55a042nd aplicadas</a>.) Ent�o, se um arquivo de um diret�rio
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <code>/www/htdocs/example</code> � requerido, o Apache precisa
9ecf04e1256ba153c86e74edb77cfd705c55a042nd procurar pelos seguintes arquivos:</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd /.htaccess<br />
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Assim, para cada acesso de arquivo fora desse diret�rio,
9ecf04e1256ba153c86e74edb77cfd705c55a042nd existem 4 acessos ao sistema de arquivos adicionais, mesmo
9ecf04e1256ba153c86e74edb77cfd705c55a042nd que nenhum desses arquivos estejam presentes. (Note que esse
9ecf04e1256ba153c86e74edb77cfd705c55a042nd normalmente n�o � o verdade.)</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>A segunda considera��o � relativa � seguran�a.
9ecf04e1256ba153c86e74edb77cfd705c55a042nd Voc� est� permitindo que os usu�rios modifiquem as
9ecf04e1256ba153c86e74edb77cfd705c55a042nd configura��es do servidor, o que pode resultar em mudan�as
9ecf04e1256ba153c86e74edb77cfd705c55a042nd que podem fugir ao seu controle. Considere com cuidado se voc� quer
9ecf04e1256ba153c86e74edb77cfd705c55a042nd ou n�o dar aos seus usu�rios esses privil�gios. Note tamb�m
9ecf04e1256ba153c86e74edb77cfd705c55a042nd que dar aos usu�rios menos privil�gios que eles precisam, acarreta em
9ecf04e1256ba153c86e74edb77cfd705c55a042nd pedidos de suporte t�cnico adicionais. Tenha certeza que voc� comunicou
9ecf04e1256ba153c86e74edb77cfd705c55a042nd aos usu�rios que n�vel de privil�gios voc� os deu.
9ecf04e1256ba153c86e74edb77cfd705c55a042nd Especificar exatamente o que voc� configurou na diretriz <code class="directive"><a href="/mod/core.html#allowoverride">AllowOverride</a></code>, e direcion�-los para a
9ecf04e1256ba153c86e74edb77cfd705c55a042nd documenta��o relevante, ir� poup�-lo de muita confus�o
9ecf04e1256ba153c86e74edb77cfd705c55a042nd depois.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Perceba que � exatamente equivalente colocar o arquivo
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <code>/www/htdocs/example</code> contendo uma diretriz, e
9ecf04e1256ba153c86e74edb77cfd705c55a042nd adicionar a mesma diretriz em uma se��o <em>Directory</em>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <code><Directory /www/htdocs/example></code> na configura��o
9ecf04e1256ba153c86e74edb77cfd705c55a042nd principal do seu servidor:</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Arquivo <code>.htaccess</code> em <code>/www/htdocs/example</code>:</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <div class="example"><h3>Conte�do de um arquivo .htaccess em
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <div class="example"><h3>Se��o do seu arquivo <code>httpd.conf</code></h3><p><code>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd </Directory>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>No entanto, adicionando isso ao seu arquivo de configura��o do
9ecf04e1256ba153c86e74edb77cfd705c55a042nd servidor resultar� em uma menor perda de performance, na medida que
9ecf04e1256ba153c86e74edb77cfd705c55a042nd a configura��o � carregada no momento da inicializa��o do
9ecf04e1256ba153c86e74edb77cfd705c55a042nd servidor, ao inv�s de toda que que um arquivo � requerido.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>O uso de arquivos <code>.htaccess</code> pode ser totalmente
9ecf04e1256ba153c86e74edb77cfd705c55a042nd desabilitado, ajustando a diretriz <code class="directive"><a href="/mod/core.html#allowoverride">AllowOverride</a></code> para <code>none</code>:</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd AllowOverride None
9ecf04e1256ba153c86e74edb77cfd705c55a042nd</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<h2><a name="how" id="how">Como as diretrizes s�o aplicadas</a></h2>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>As diretrizes de configura��o que se encontram em um arquivo
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <code>.htaccess</code> s�o aplicadas para o diret�rio no qual o
9ecf04e1256ba153c86e74edb77cfd705c55a042nd arquivo <code>.htaccess</code> se encontra, e para todos os
9ecf04e1256ba153c86e74edb77cfd705c55a042nd subdiret�rios ali presentes. Mas, � importante lembrar tamb�m que
9ecf04e1256ba153c86e74edb77cfd705c55a042nd podem existir arquivos <code>.htaccess</code> no diret�rios
9ecf04e1256ba153c86e74edb77cfd705c55a042nd superiores. As diretrizes s�o aplicadas na ordem que s�o
9ecf04e1256ba153c86e74edb77cfd705c55a042nd achadas. Logo, um arquivo <code>.htaccess</code> em um diret�rio
9ecf04e1256ba153c86e74edb77cfd705c55a042nd em particular, pode sobrescrever as diretrizes encontradas em um
9ecf04e1256ba153c86e74edb77cfd705c55a042nd diret�rio acima deste em sua respectiva �rvore. Estes, por sua vez,
9ecf04e1256ba153c86e74edb77cfd705c55a042nd podem ter suas diretrizes sobrescritas por diretrizes ainda mais
9ecf04e1256ba153c86e74edb77cfd705c55a042nd acima, ou no pr�prio arquivo de configura��o principal do
9ecf04e1256ba153c86e74edb77cfd705c55a042nd servidor.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>No diret�rio <code>/www/htdocs/example1</code> n�s temos
9ecf04e1256ba153c86e74edb77cfd705c55a042nd um arquivo <code>.htaccess</code> contendo o seguinte:</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd Options +ExecCGI
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>(Nota: voc� deve ter "<code>AllowOverride Options</code>" para
9ecf04e1256ba153c86e74edb77cfd705c55a042nd permitir o uso da diretriz "<code class="directive"><a href="/mod/core.html#options">Options</a></code>" nos arquivos
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>No diret�rio <code>/www/htdocs/example1/example2</code> n�s temos
9ecf04e1256ba153c86e74edb77cfd705c55a042nd Options Includes
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Devido a esse segundo arquivo <code>.htaccess</code>, no
9ecf04e1256ba153c86e74edb77cfd705c55a042nd diret�rio <code>/www/htdocs/example1/example2</code>, a execu��o
9ecf04e1256ba153c86e74edb77cfd705c55a042nd de scripts CGI n�o � permitida, pois somente <code>Options
9ecf04e1256ba153c86e74edb77cfd705c55a042nd Includes</code> est� em efeito, o que sobrescreve completamente
9ecf04e1256ba153c86e74edb77cfd705c55a042nd quaisquer outros ajustes previamente configurados.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<h2><a name="auth" id="auth">Exemplo de Autentica��o</a></h2>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Se voc� veio diretamente � esta parte do documento para
9ecf04e1256ba153c86e74edb77cfd705c55a042nd aprender como fazer autentica��o, � importante notar uma
9ecf04e1256ba153c86e74edb77cfd705c55a042nd coisa. Existe uma concep��o errada, mas muito comum, de que �
9ecf04e1256ba153c86e74edb77cfd705c55a042nd necess�rio o uso de arquivos <code>.htaccess</code> para implementar
9ecf04e1256ba153c86e74edb77cfd705c55a042nd a autentica��o por senha. Este n�o � o caso. Colocar
9ecf04e1256ba153c86e74edb77cfd705c55a042nd diretrizes de senha em uma se��o <code class="directive"><a href="/mod/core.html#directory"><Directory></a></code>, no seu arquivo principal de
9ecf04e1256ba153c86e74edb77cfd705c55a042nd configura��o do servidor, � a melhor maneira de se implementar
9ecf04e1256ba153c86e74edb77cfd705c55a042nd isto, e os arquivos <code>.htaccess</code> devem ser usados apenas
9ecf04e1256ba153c86e74edb77cfd705c55a042nd se voc� n�o tem acesso ao arquivo principal de configura��o do
9ecf04e1256ba153c86e74edb77cfd705c55a042nd servidor. Veja <a href="#when">acima</a> a discuss�o sobre quando
9ecf04e1256ba153c86e74edb77cfd705c55a042nd voc� deve e quando n�o deve usar os arquivos
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Dito isso, se voc� ainda acredita que precisa usar um arquivo
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <code>.htaccess</code>, a configura��o a seguir provavelmente
9ecf04e1256ba153c86e74edb77cfd705c55a042nd funcionar� para voc�.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd AuthType Basic<br />
9ecf04e1256ba153c86e74edb77cfd705c55a042nd AuthName "Password Required"<br />
9ecf04e1256ba153c86e74edb77cfd705c55a042nd Require Group admins
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Note que <code>AllowOverride AuthConfig</code> precisa estar
9ecf04e1256ba153c86e74edb77cfd705c55a042nd habilitado para que estas diretrizes tenham efeito.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd autentica��o</a> para uma discuss�o mais completa sobre
9ecf04e1256ba153c86e74edb77cfd705c55a042nd autentica��o e autoriza��o.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<h2><a name="ssi" id="ssi">Exemplo de Server Side Includes</a></h2>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Outro uso comum de arquivos <code>.htaccess</code> � ativar o
9ecf04e1256ba153c86e74edb77cfd705c55a042nd Server Side Includes para um diret�rio em particular. Isto pode
9ecf04e1256ba153c86e74edb77cfd705c55a042nd ser feito com as seguintes diretrizes de configura��o, colocadas em
9ecf04e1256ba153c86e74edb77cfd705c55a042nd um arquivo <code>.htaccess</code> no diret�rio desejado:</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd Options +Includes<br />
9ecf04e1256ba153c86e74edb77cfd705c55a042nd AddHandler server-parsed shtml
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <code>AllowOverride FileInfo</code> precisam estar habilitados
9ecf04e1256ba153c86e74edb77cfd705c55a042nd para essas diretrizes terem efeito.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Por favor veja o <a href="ssi.html">tutorial de SSI</a> para
9ecf04e1256ba153c86e74edb77cfd705c55a042nd uma discuss�o mais completa sobre server-side includes.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Finalmente, voc� pode querer que um arquivo
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <code>.htaccess</code> permita a execu��o de programas CGI em um
9ecf04e1256ba153c86e74edb77cfd705c55a042nd diret�rio em particular. Isto pode ser implementado com as
9ecf04e1256ba153c86e74edb77cfd705c55a042nd seguintes configura��es:</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd Options +ExecCGI<br />
9ecf04e1256ba153c86e74edb77cfd705c55a042nd AddHandler cgi-script cgi pl
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Alternativamente, se voc� desejar que todos os arquivos de um
9ecf04e1256ba153c86e74edb77cfd705c55a042nd dado diret�rio, sejam considerados programas CGI, isso pode ser
9ecf04e1256ba153c86e74edb77cfd705c55a042nd feito com a seguinte configura��o:</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd Options +ExecCGI<br />
9ecf04e1256ba153c86e74edb77cfd705c55a042nd SetHandler cgi-script
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <code>AllowOverride FileInfo</code> precisam estar habilitados
9ecf04e1256ba153c86e74edb77cfd705c55a042nd para que essas diretrizes tenham quaisquer efeito.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd tutorial</a> para uma discuss�o mais completa sobre programa��o
9ecf04e1256ba153c86e74edb77cfd705c55a042nd e configura��o CGI.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<h2><a name="troubleshoot" id="troubleshoot">Resolvendo Problemas</a></h2>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Quando voc� adiciona diretrizes de configura��o em um arquivo
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <code>.htaccess</code>, e n�o obt�m o efeito desejado, existe uma
9ecf04e1256ba153c86e74edb77cfd705c55a042nd s�rie de pontos que podem estar errados.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Mais comumente, o problema � que a diretriz <code class="directive"><a href="/mod/core.html#allowoverride">AllowOverride</a></code> n�o est� habilitada
9ecf04e1256ba153c86e74edb77cfd705c55a042nd corretamente para que as suas diretrizes de configura��es sejam
9ecf04e1256ba153c86e74edb77cfd705c55a042nd honradas. Verifique se voc� n�o possui <code>AllowOverride
9ecf04e1256ba153c86e74edb77cfd705c55a042nd None</code> ajustado para o escopo do arquivo em quest�o. Um bom
9ecf04e1256ba153c86e74edb77cfd705c55a042nd meio de testar isso � colocar "lixo" em seu arquivo
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <code>.htaccess</code> e recarreg�-lo. Se n�o for gerado nenhum
9ecf04e1256ba153c86e74edb77cfd705c55a042nd erro do servidor, certamente voc� tem <code>AllowOverride
9ecf04e1256ba153c86e74edb77cfd705c55a042nd <p>Se, por outro lado, voc� est� obtendo erros do servidor ao
9ecf04e1256ba153c86e74edb77cfd705c55a042nd tentar acessar documentos, verifique o registro de erros do
9ecf04e1256ba153c86e74edb77cfd705c55a042nd Apache. Ele provavelmente ir� indicar que a diretriz usada em
9ecf04e1256ba153c86e74edb77cfd705c55a042nd Alternativamente, ele pode acusar erros de sintaxe que voc� ter�
9ecf04e1256ba153c86e74edb77cfd705c55a042nd que corrigir.</p>
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<p><span>L�nguas Dispon�veis: </span><a href="/en/howto/htaccess.html" hreflang="en" rel="alternate" title="English"> en </a> |
c04f76acce77126cf88b09350e56ea8c6b4a064enilgun<a href="/fr/howto/htaccess.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> |
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<a href="/ja/howto/htaccess.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
9ecf04e1256ba153c86e74edb77cfd705c55a042nd<a href="/ko/howto/htaccess.html" hreflang="ko" rel="alternate" title="Korean"> ko </a> |
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<a href="/pt-br/howto/htaccess.html" title="Portugu�s (Brasil)"> pt-br </a></p>
727872d18412fc021f03969b8641810d8896820bhumbedooh</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Coment�rios</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
727872d18412fc021f03969b8641810d8896820bhumbedoohvar comments_shortname = 'httpd';
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedoohvar comments_identifier = 'http://httpd.apache.org/docs/trunk/howto/htaccess.html';
0d0ba3a410038e179b695446bb149cce6264e0abnd(function(w, d) {
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
727872d18412fc021f03969b8641810d8896820bhumbedooh d.write('<div id="comments_thread"><\/div>');
0d0ba3a410038e179b695446bb149cce6264e0abnd var s = d.createElement('script');
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
0d0ba3a410038e179b695446bb149cce6264e0abnd (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
727872d18412fc021f03969b8641810d8896820bhumbedooh d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
0d0ba3a410038e179b695446bb149cce6264e0abnd})(window, document);
205f749042ed530040a4f0080dbcb47ceae8a374rjung<p class="apache">Copyright 2015 The Apache Software Foundation.<br />Licenciado sob a <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<p class="menu"><a href="/mod/">M�dulos</a> | <a href="/mod/quickreference.html">Diretrizes</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Gloss�rio</a> | <a href="/sitemap.html">Mapa do site</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
0d0ba3a410038e179b695446bb149cce6264e0abndif (typeof(prettyPrint) !== 'undefined') {
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd prettyPrint();