{"id":192,"date":"2008-11-30T09:33:39","date_gmt":"2008-11-30T12:33:39","guid":{"rendered":"http:\/\/www.franklinjr.com\/blog\/index.php\/2008\/11\/30\/proteger-diretorio-com-htaccess-no-apache\/"},"modified":"2009-03-28T08:39:36","modified_gmt":"2009-03-28T11:39:36","slug":"proteger-diretorio-com-htaccess-no-apache","status":"publish","type":"post","link":"https:\/\/www.franklinjr.com\/blog\/index.php\/2008\/11\/30\/proteger-diretorio-com-htaccess-no-apache\/","title":{"rendered":"Proteger diret\u00f3rio com .htaccess no apache"},"content":{"rendered":"<p>Bah, ainda n\u00e3o tinha postado isso, putz, mas ent\u00e3o, pra proteger um diret\u00f3rio crie um arquivo de texto chamado .htaccess e cole o seguinte conte\u00fado<!--more--> nele:<\/p>\n<p><span style=\"color: #008000;\">AuthType Basic<br \/>\nAuthName &#8220;Protegido&#8221;<br \/>\nAuthUserFile \/home\/blablabla\/public_html\/teste\/.htpasswd<br \/>\nrequire valid-user<\/span><\/p>\n<p>onde <span style=\"color: #008000;\">\/home\/blablabla\/public_html\/teste<span style=\"color: #000000;\"> deve ser o caminho f\u00edsico do servidor do diret\u00f3rio onde tu quer proteger, feito isso, por ssh tu digita esse comando na tua conta, no mesmo diret\u00f3rio que tu quer proteger, no caso \/home\/blablabla\/public_html\/teste:<\/span><\/span><\/p>\n<p><span style=\"color: #008000;\">htpasswd -c .htpasswd username_desejado<\/span><\/p>\n<p>detalhe importante, esse comando diz mais ou menos assim, cria um arquivo chamado .htpasswd <span style=\"color: #ff0000;\">ZERADO<\/span> (-c) com o username_desejado. Agora, se tu quiser proteger o diret\u00f3rio com mais de um usu\u00e1rio, tu digita o comando acima para o PRIMEIRO usu\u00e1rio, nos demais o comando deve ser<\/p>\n<p><span style=\"color: #008000;\">htpasswd .htpasswd usuario_desejado<\/span><\/p>\n<p>sem o -c, porque o -c ele vai criar um novo arquivo apagando o atual com o que j\u00e1 tem os usu\u00e1rios cadastrados.<\/p>\n<p>E \u00e9 isso a\u00ed \ud83d\ude00<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bah, ainda n\u00e3o tinha postado isso, putz, mas ent\u00e3o, pra proteger um diret\u00f3rio crie um arquivo de texto chamado .htaccess e cole o seguinte conte\u00fado<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[144,85],"tags":[263,264],"class_list":["post-192","post","type-post","status-publish","format-standard","hentry","category-htaccess","category-apache","tag-proteger-diretorio","tag-protegido"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\r\n<title>Proteger diret\u00f3rio com .htaccess no apache - Franklin Jr.<\/title>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/www.franklinjr.com\/blog\/index.php\/2008\/11\/30\/proteger-diretorio-com-htaccess-no-apache\/\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.franklinjr.com\\\/blog\\\/index.php\\\/2008\\\/11\\\/30\\\/proteger-diretorio-com-htaccess-no-apache\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\\\/\\\/www.franklinjr.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Proteger diret\u00f3rio com .htaccess no apache\"}]}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Proteger diret\u00f3rio com .htaccess no apache - Franklin Jr.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.franklinjr.com\/blog\/index.php\/2008\/11\/30\/proteger-diretorio-com-htaccess-no-apache\/","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/www.franklinjr.com\/blog\/index.php\/2008\/11\/30\/proteger-diretorio-com-htaccess-no-apache\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/www.franklinjr.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Proteger diret\u00f3rio com .htaccess no apache"}]}]}},"_links":{"self":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/192","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=192"}],"version-history":[{"count":1,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/192\/revisions"}],"predecessor-version":[{"id":283,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/192\/revisions\/283"}],"wp:attachment":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}