{"id":2317,"date":"2017-02-01T02:10:03","date_gmt":"2017-02-01T02:10:03","guid":{"rendered":"https:\/\/www.calistohosting.com\/blog\/?p=2317"},"modified":"2017-05-24T02:02:10","modified_gmt":"2017-05-24T02:02:10","slug":"como-proteger-con-contrasena-un-solo-archivo-con-htaccess","status":"publish","type":"post","link":"https:\/\/www.calistohosting.com\/blog\/2017\/02\/01\/como-proteger-con-contrasena-un-solo-archivo-con-htaccess\/","title":{"rendered":"C\u00f3mo proteger con contrase\u00f1a un solo archivo con htaccess"},"content":{"rendered":"<div id=\"pl-2317\"  class=\"panel-layout\" ><div id=\"pg-2317-0\"  class=\"panel-grid panel-no-style\" ><div id=\"pgc-2317-0-0\"  class=\"panel-grid-cell\" ><div id=\"panel-2317-0-0-0\" class=\"so-panel widget widget_sow-editor panel-first-child\" data-index=\"0\" ><div\n\t\t\t\n\t\t\tclass=\"so-widget-sow-editor so-widget-sow-editor-base\"\n\t\t\t\n\t\t>\n<div class=\"siteorigin-widget-tinymce textwidget\">\n\t<p>El archivo .<strong>htaccess<\/strong> es una herramienta poderosa donde muchos detr\u00e1s de las cosas de la escena se manejan. Adem\u00e1s de cosas como forzar un formato de <strong>url<\/strong> espec\u00edfico, tambi\u00e9n puede ayudar con el acceso a ciertas p\u00e1ginas. Muchos sitios tienen \u00e1reas en sus sitios web para\u00a0miembros \u00fanicamente. Estos son codificados para comprobar contra una base de datos con idiomas como <strong>php<\/strong>, o agrupados en una sola subcarpeta que est\u00e1 protegido con contrase\u00f1a a trav\u00e9s del <strong>cPanel<\/strong>.<\/p>\n<p>Hay veces, sin embargo, cuando s\u00f3lo desea proteger con contrase\u00f1a una sola p\u00e1gina que est\u00e1 en una carpeta p\u00fablica. Tal vez el programa con el que construy\u00f3 su sitio no cree subcarpetas y mover un archivo a un \u00e1rea protegida romper\u00eda los v\u00ednculos del sitio. Aqu\u00ed es donde el archivo <strong>htaccess<\/strong> puede ayudar. Siga las instrucciones a continuaci\u00f3n mientras le guiamos a trav\u00e9s de la contrase\u00f1a protegiendo un solo archivo a trav\u00e9s de su archivo <strong>htaccess<\/strong>.<\/p>\n<\/div>\n<\/div><\/div><div id=\"panel-2317-0-0-1\" class=\"so-panel widget widget_sow-editor panel-last-child\" data-index=\"1\" ><div\n\t\t\t\n\t\t\tclass=\"so-widget-sow-editor so-widget-sow-editor-base\"\n\t\t\t\n\t\t><h3 class=\"widget-title\">Contrase\u00f1a protegiendo un solo archivo en su sitio web<\/h3>\n<div class=\"siteorigin-widget-tinymce textwidget\">\n\t<p><span title=\"Step 1.First we want to create a username and an encoded password that we will use for the login.\">1. Primero queremos crear un nombre de usuario y una contrase\u00f1a codificada que usaremos para el inicio de sesi\u00f3n. <\/span><span title=\"This is not done directly in the cpanel, but from a site on the web that can encode the word you want to use as your password.\">Esto no se hace directamente en el <strong>cpanel<\/strong>, sino desde un sitio en la web que puede codificar la palabra que desea utilizar como contrase\u00f1a. <\/span><span title=\"There are many sites that have scripts to do this.\">Hay muchos sitios que tienen scripts para hacer esto. <\/span><span title=\"The link we have here is from 4WebHelp.net which is a webmaster tools site.\n\">El enlace que tenemos aqu\u00ed es de <strong>4WebHelp.net<\/strong> que es un sitio de herramientas para <strong>webmasters<\/strong>.<\/span><\/p>\n<p><span title=\"Step 2.From the site link, copy and paste the code it gives you to a text editor as you will need it later.\">2. Desde el enlace del sitio, copie y pegue el c\u00f3digo que le da a un editor de texto como lo necesitar\u00e1 m\u00e1s tarde. <\/span><span title=\"For reference, the format of the code it gives you is username:encoded_password.\n\">Para la referencia, el formato del c\u00f3digo que le da es<strong> username: encoded_password<\/strong>.<\/span><\/p>\n<p><span title=\"Step 3.Next, you want to log into your cPanel.\n\">3. A continuaci\u00f3n,\u00a0inicie sesi\u00f3n en su <strong>cPanel<\/strong>.<\/span><\/p>\n<p><span title=\"Step 4.Find the Files category and click on the File Manager icon.\n\">4. Consulte la categor\u00eda de <strong>archivos<\/strong> y haga clic en el icono del <strong>Administrador de archivos<\/strong>.<br \/><\/span><span title=\"cpanel\n\"><br \/><\/span><span title=\"Step 5.A popup box will appear.\">5. Aparecer\u00e1 un cuadro emergente. <\/span><span title=\"We need to make a quick stop in the Home directory so we can create a file that is not accessible directly from a web browser.\">Tenemos que hacer una parada r\u00e1pida en el directorio de inicio para poder crear un archivo que no es accesible directamente desde un navegador web. <\/span><span title=\"Select the Home Directory option.\">Seleccione la opci\u00f3n Directorio de inicio. <\/span><span title=\"Also ensure the Show Hidden Files option is checked.\">Aseg\u00farese tambi\u00e9n de que la opci\u00f3n <strong>Mostrar archivos ocultos<\/strong> est\u00e9 marcada.<\/span><span title=\"From there, click on the Go button at the bottom.\n\"><br \/><\/span><span title=\"file-manager-home-dir\n\"><br \/><\/span><span title=\"Step 6.You are now in the home directory of the hosting account.\">6. Ahora est\u00e1s en el directorio de inicio de la cuenta de alojamiento. <\/span><span title=\"The home directory is not accessible from the web via a URL, so it is more secure.\">El directorio de inicio no es accesible desde la web a trav\u00e9s de una <strong>URL<\/strong>, por lo que es m\u00e1s seguro. <\/span><span title=\"We want to create a password file here that will be used to check access for users trying to get to the file we are going to protect.\">Queremos crear un archivo de contrase\u00f1a aqu\u00ed que se utilizar\u00e1 para comprobar el acceso de los usuarios que intenten acceder al archivo que vamos a proteger. <\/span><span title=\"You will want to create a new text file.\">Desear\u00e1 crear un nuevo archivo de texto. <\/span><span title=\"To do so, find the New File icon from the top menu bar and click it.\n\">Para ello, busque el icono <strong>Nuevo archivo<\/strong> en la barra de men\u00fa superior y haga clic en \u00e9l.<br \/><\/span><span title=\"cpanel-new-file\n\"><br \/><\/span><span title=\"Step 7.A popup will appear, asking to name the file.\">7. Aparecer\u00e1 una ventana emergente que le pedir\u00e1 que nombre el archivo. <\/span><span title=\"Here we named it .htpassword (Note that the filename begins with a period. This is intentional as it makes the file hidden.) Below that is a field to enter a path to store the file.\">Aqu\u00ed lo llamamos <strong>.htpassword<\/strong> (Tenga en cuenta que el nombre de archivo comienza con un punto.Esto es intencional, ya que hace\u00a0al archivo oculto.) Debajo de ese es un campo para ingresar una ruta para almacenar el archivo. <\/span><span title=\"Leave it blank so it will default to the root folder.\">Deje en blanco para que guarde de forma predeterminada\u00a0en la carpeta ra\u00edz. <\/span><span title=\"Click on Create New File to continue.\n\">Haga clic en <strong>Crear nuevo archivo<\/strong> para continuar.<br \/><\/span><span title=\"name-password-file\n\"><br \/><\/span><span title=\"Step 8.The new file is now in your account.\">8. El nuevo archivo est\u00e1 ahora en su cuenta. <\/span><span title=\"In the right hand pane, scroll down until you find the file, then right click on it.\">En el panel derecho, despl\u00e1cese hacia abajo hasta encontrar el archivo, luego haga clic derecho en \u00e9l. <\/span><span title=\"Click on the Edit option from the menu that appears.\">Haga clic en la opci\u00f3n <strong>Editar<\/strong> del men\u00fa que aparece. <\/span><span title=\"A popup will appear, simply click on the Edit button in the lower right to continue.\n\">Aparecer\u00e1 una ventana emergente, simplemente haga clic en el bot\u00f3n <strong>Editar<\/strong> en la parte inferior derecha para continuar.<br \/><\/span><span title=\"find-htpassword\n\"><br \/><\/span><span title=\"Step 9.We are now in the editor.\">9. Ahora estamos en el editor. <\/span><span title=\"Cut and paste the username and password code you were given before.\">Cortar y pegar el nombre de usuario y c\u00f3digo de contrase\u00f1a que le dieron antes. <\/span><span title=\"Keep the code as a single line and do not edit it.\">Guarde el c\u00f3digo como una sola l\u00ednea y no lo edite. <\/span><span title=\"Click on the Save Changes button to save the file.\n\">Haga clic en el bot\u00f3n <strong>Guardar<\/strong> cambios para guardar el archivo.<br \/><\/span><span title=\"save-htpassword\n\"><br \/><\/span><span title=\"Step 10.Now, we want to move to the root folder for your domain and alter the .htaccess file so that visitors are challenged with the login prompt.\">10. Ahora, queremos pasar a la carpeta ra\u00edz de su dominio y alterar el archivo .<strong>htaccess<\/strong> para que los visitantes se enfrentan con el indicador de inicio de sesi\u00f3n. <\/span><span title=\"If you are working with the primary domain, double click on the public_html folder to enter.\">Si est\u00e1 trabajando con el dominio principal, haga doble clic en la carpeta <strong>public_html<\/strong> para ingresar. <\/span><span title=\"For addon domains, double click on the public_html folder and then find the subfolder that is the root for the domain and double click that one to enter its root.\">Para los dominios addon, haga doble clic en la carpeta <strong>public_html<\/strong> y luego busque la subcarpeta que es la ra\u00edz del dominio y haga doble clic en ella para ingresar su ra\u00edz. <\/span><span title=\"For our example, we are using the primary domain.\">Para nuestro ejemplo, estamos utilizando el dominio principal. <\/span><span title=\"Locate the .htaccess file and right click it as you did before with your password file.\">Busque el archivo .<strong>htaccess<\/strong> y haga clic derecho en \u00e9l como lo hizo antes con su archivo de contrase\u00f1a. <\/span><span title=\"This also brings up a menu.\">Esto tambi\u00e9n trae un men\u00fa. <\/span><span title=\"Find and click on the Edit option.\">Busque y haga clic en la opci\u00f3n <strong>Editar<\/strong>. <\/span><span title=\"If you get a popup box, simply find and click the Edit button in the lower right corner to continue to the editor.\n\">Si obtiene un cuadro emergente, simplemente busque y haga clic en el bot\u00f3n <strong>Editar<\/strong> en la esquina inferior derecha para continuar con el editor.<br \/><\/span><span title=\"file-manager-htaccess\n\"><br \/><\/span><span title=\"Step 11.You are now in the text editor for the .htaccess file.\">11. Est\u00e1 ahora en el editor de texto para el archivo .<strong>htaccess<\/strong>. <\/span><span title=\"Place the following code into your htaccess so that it prompts the visitor for a login.\n\n\">Coloque el c\u00f3digo siguiente en su <strong>htaccess<\/strong> para que pida al visitante un inicio de sesi\u00f3n.<\/p>\n<p><\/span><span title=\"&lt;\/files&gt;\n\n\n\"><span style=\"color: #ff0000;\">AuthUserFile \/home\/usuario6\/.htpassword<\/span><br \/><span style=\"color: #ff0000;\"> AuthName \"nombre de la solicitud de inicio de sesi\u00f3n\"<\/span><br \/><span style=\"color: #ff0000;\"> AuthType basic<\/span><br \/><span style=\"color: #ff0000;\">&lt; files pagename&gt;<\/span><br \/><span style=\"color: #ff0000;\"> require valid-user<\/span><br \/><span style=\"color: #ff0000;\">&lt; \/files&gt;<\/span><\/p>\n<p><\/span><em><span title=\"The pagename should be the exact page in that directory, not an absolute path.\n\u00a0\">El nombre de la paginaci\u00f3n debe ser la p\u00e1gina exacta en ese directorio, no una ruta absoluta.<br \/><\/span><\/em><span title=\"For example: \/home\/user\/public_html\/wp-login.php would just have wp-login.php in the .htaccess file in that directory.\n\n\"><em>Por ejemplo: \/home\/usuario6\/public_html\/wp-login.php s\u00f3lo tendr\u00eda wp-login.php en el archivo .<strong>htaccess<\/strong> en ese directorio.<\/em><\/p>\n<p><\/span><span title=\"Step 12.Before you save it, there are a few items to change.\">12. Antes de guardarlo, hay algunos elementos que cambiar. <\/span><span title=\"First, change '\/path\/to\/htpasswd\/file\/.htpassword' to the actual path to your .htpassword file.\">Primero, cambie <span style=\"color: #000000;\"><strong>\/home\/usuario6\/.htpassword <\/strong><\/span>a la ruta real de su archivo .<strong>htpassword<\/strong>. <\/span><span title=\"For example, your path would look like \/home\/username\/.htpassword (be sure to replace 'username' with your real cpanel username.)\n\">Por ejemplo, su ruta se ver\u00eda como <strong>\/home\/usuario6\/.htpassword<\/strong> (aseg\u00farese de reemplazar <strong>'usuario6'<\/strong> con su nombre de usuario real de <strong>cpanel<\/strong>.)<\/span><\/p>\n<p><span title=\"Step 13.Second, change the AuthName to something meanignful.\">13. En segundo lugar, cambie el <strong>AuthName<\/strong>. <\/span><span title=\"This is the title of the login prompt.\n\">Este es el t\u00edtulo del indicador de inicio de sesi\u00f3n.<\/span><\/p>\n<p><span title=\"Step 15.Click on the Save Changes button at the top to save the file.\n\">14. Haga clic en el bot\u00f3n <strong>Guardar<\/strong> cambios en la parte superior para guardar el archivo.<\/span><\/p>\n<p><span title=\"Step 16.Visit the page on your site to ensure that it is asking for the login.\">15. Visita la p\u00e1gina de tu sitio para asegurarte de que est\u00e1 solicitando el inicio de sesi\u00f3n. <\/span><span title=\"Once you log in, the site will likely not ask again when you return as the browser remembers your previous visit.\">Una vez que inicie sesi\u00f3n, es probable que el sitio no vuelva a preguntar cuando regrese, ya que el navegador recuerda su visita anterior.<\/span><\/p>\n<\/div>\n<\/div><\/div><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>El archivo .htaccess es una herramienta poderosa donde muchos detr\u00e1s de las cosas de la escena se manejan. Adem\u00e1s de cosas como forzar un formato de url espec\u00edfico, tambi\u00e9n puede ayudar con el acceso a ciertas p\u00e1ginas. Muchos sitios tienen \u00e1reas en sus sitios web para\u00a0miembros \u00fanicamente. Estos son codificados&#8230;<\/p>\n","protected":false},"author":1,"featured_media":2450,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[154,151,153],"tags":[209,213,214,212,210,155,211,208,169,215],"class_list":["post-2317","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-htaccess","category-website","category-soporte","tag-4webhelp","tag-authname","tag-authtype","tag-authuserfile","tag-encoded_password","tag-htaccess","tag-htpassword","tag-proteger-con-contrasena","tag-public_html","tag-valid-user"],"_links":{"self":[{"href":"https:\/\/www.calistohosting.com\/blog\/wp-json\/wp\/v2\/posts\/2317","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.calistohosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.calistohosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.calistohosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.calistohosting.com\/blog\/wp-json\/wp\/v2\/comments?post=2317"}],"version-history":[{"count":2,"href":"https:\/\/www.calistohosting.com\/blog\/wp-json\/wp\/v2\/posts\/2317\/revisions"}],"predecessor-version":[{"id":2451,"href":"https:\/\/www.calistohosting.com\/blog\/wp-json\/wp\/v2\/posts\/2317\/revisions\/2451"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.calistohosting.com\/blog\/wp-json\/wp\/v2\/media\/2450"}],"wp:attachment":[{"href":"https:\/\/www.calistohosting.com\/blog\/wp-json\/wp\/v2\/media?parent=2317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.calistohosting.com\/blog\/wp-json\/wp\/v2\/categories?post=2317"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.calistohosting.com\/blog\/wp-json\/wp\/v2\/tags?post=2317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}