{"id":927,"date":"2019-03-30T23:36:23","date_gmt":"2019-03-31T05:36:23","guid":{"rendered":"http:\/\/microgecko.com\/binnacle\/?p=927"},"modified":"2020-10-28T14:47:10","modified_gmt":"2020-10-28T20:47:10","slug":"modificacion-de-htaccess-para-redireccionar-http-a-https-y-modificaciones-a-codigo","status":"publish","type":"post","link":"https:\/\/microgecko.isi.com.mx\/?p=927","title":{"rendered":"Modificaci\u00f3n de .htaccess para redireccionar http a https y modificaciones a c\u00f3digo"},"content":{"rendered":"<p><span style=\"font-family: Times New Roman; font-size: 12pt;\">Desde mayo de 2018, su sitio incluye certificado SSL, lo que significa que las p\u00e1ginas se pueden acceder por https y el correo entrante con SSL<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 12pt;\">Se tom\u00f3 la iniciativa tras el anuncio de Google en el cual indicaban que Chrome ya no iba a abrir p\u00e1ginas que no tuvieran certificado. A la fecha (marzo 2019) esto no ha ocurrido, \u00fanicamente las marca como no seguras. Para ciertos usuarios es raz\u00f3n suficiente para bloquear o abandonar la p\u00e1gina. Tras la experiencia de NPAPI que de similar forma muchas p\u00e1ginas dejaron de funcionar, le sugerimos haga este cambio programadamente.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 12pt;\">En t\u00e9rminos generales, transmitir la informaci\u00f3n con un certificado SSL significa que la informaci\u00f3n viaja encriptada y depende que el emisor y el receptor conozcan la clave SSL almacenada en una tercera entidad.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 12pt;\">Si bien su sitio ya cuenta con el certificado SSL, NO SIGNIFICA que su sitio va a abrir como https:\/\/ en lugar de http:\/\/ eso lo debe hacer el encargado de administrar el sitio o de subir la p\u00e1gina a quien no le debe representar mayor esfuerzo.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 12pt;\">Se sugiere hacer \u00e9sta redirecci\u00f3n desde el archivo .htacccess que se encuentra en la carpeta public_html de su sitio. Recuerde que es un archivo oculto, por lo que si lo desea modificar desde el administrador de archivos de su panel de control, no olvide colocar en las preferencias (arriba a la derecha) la opci\u00f3n de mostrar archivos ocultos.<br \/>\n<\/span><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/microgecko.com\/binnacle\/wp-content\/uploads\/2019\/03\/033119_0536_Modificacin1.png\" alt=\"\" \/><span style=\"font-family: Times New Roman; font-size: 12pt;\"><br \/>\n<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/microgecko.com\/binnacle\/wp-content\/uploads\/2019\/03\/033119_0536_Modificacin2.png\" alt=\"\" \/><span style=\"font-family: Times New Roman; font-size: 12pt;\"><br \/>\n<img decoding=\"async\" src=\"http:\/\/microgecko.com\/binnacle\/wp-content\/uploads\/2019\/03\/033119_0536_Modificacin3.png\" alt=\"\" \/><br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 12pt;\">Las l\u00edneas de c\u00f3digo a agregar al .htaccess son:<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 12pt;\">RewriteEngine On<br \/>\nRewriteCond %{HTTPS} off<br \/>\nRewriteRule ^(.*)$ https:\/\/%{HTTP_HOST}%{REQUEST_URI} [L,R=301]<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 12pt;\">Si ya existen de preferencia no dejar lineas duplicadas, si fuera as\u00ed, la que manda es la \u00faltima.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 12pt;\">ie.: Un sitio reci\u00e9n creado (sin contenido) unicamente aparecer\u00e1:<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">RewriteEngine on<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 12pt;\">Una p\u00e1gina t\u00edpica de WordPress aparecer\u00e1 as\u00ed:<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\"># BEGIN WordPress<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">&lt;IfModule mod_rewrite.c&gt;<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">RewriteEngine On<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">RewriteBase \/<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">RewriteCond %{REQUEST_URI} !^\/\\.well-known\/acme-challenge\/[0-9a-zA-Z_-]+$<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">RewriteCond %{REQUEST_URI} !^\/\\.well-known\/cpanel-dcv\/[0-9a-zA-Z_-]+$<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">RewriteCond %{REQUEST_URI} !^\/\\.well-known\/pki-validation\/[A-F0-9]{32}\\.txt(?:\\ Comodo\\ DCV)?$<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">RewriteRule ^index\\.php$ &#8211; [L]<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">RewriteCond %{REQUEST_FILENAME} !-f<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">RewriteCond %{REQUEST_FILENAME} !-d<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">RewriteCond %{REQUEST_URI} !^\/\\.well-known\/acme-challenge\/[0-9a-zA-Z_-]+$<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">RewriteCond %{REQUEST_URI} !^\/\\.well-known\/cpanel-dcv\/[0-9a-zA-Z_-]+$<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">RewriteCond %{REQUEST_URI} !^\/\\.well-known\/pki-validation\/[A-F0-9]{32}\\.txt(?:\\ Comodo\\ DCV)?$<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">RewriteRule . \/index.php [L]<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\">&lt;\/IfModule&gt;<br \/>\n<\/span><\/p>\n<p style=\"margin-left: 35pt;\">\n<p style=\"margin-left: 35pt;\"><span style=\"font-size: 10pt;\"># END WordPress<br \/>\n<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>La sugerencia es agregar las l\u00edneas de c\u00f3digo enseguida de RewriteEngine On<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 12pt;\">Esto funcionar\u00e1 para todas los redireccionamientos relativos, por lo que si su p\u00e1gina contiene links de la forma http:\/\/www.&lt;sitio&gt;.com, deber\u00e1 actualizar a la ruta relativa.<br \/>\n<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 12pt;\">Si su p\u00e1gina est\u00e1 construida con WordPress, existen Plugins que hacen el trabajo:\u00a0 <a href=\"https:\/\/es.wordpress.org\/plugins\/https-redirection\/\" target=\"_blank\"><span style=\"color: blue; text-decoration: underline;\"><strong>Easy HTTPS Redirection<\/strong><\/span><\/a> y <a href=\"https:\/\/es.wordpress.org\/plugins\/really-simple-ssl\" target=\"_blank\"><span style=\"color: blue; text-decoration: underline;\"><strong>Really Simple SSL<\/strong><\/span><\/a> son buenas opciones para crear la redirecci\u00f3n. La<br \/>\n<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 13pt;\"><strong>Easy HTTPS Redirection<br \/>\n<\/strong><\/span><\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 12pt;\">Su configuraci\u00f3n es muy sencilla. Una vez instalado y activado, ve a <strong>Ajustes<\/strong> \/ <strong>HTTPS Redirection<\/strong> y selecciona <strong>Enable automatic redirection to the &#8220;HTTPS&#8221;<\/strong> y <strong>The whole domain<\/strong>. Puede ser recomendable que marques la opci\u00f3n <strong>Force resources to use HTTPS URL<\/strong> para forzar la carga por https de cualquier recurso con una direcci\u00f3n est\u00e1tica que haya sido utilizada en alg\u00fan art\u00edculo, por ejemplo una imagen.<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 13pt;\"><strong>Really Simple SSL<br \/>\n<\/strong><\/span><\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 12pt;\">Una vez instalado y activado, te llevar\u00e1 a <strong>Ajustes<\/strong> \/ <strong>SSL<\/strong> donde encontrar\u00e1s las siguientes recomendaciones: cambiar cualquier referencia http:\/\/ por \/\/ en la carga de archivos .css y .js, y cargar im\u00e1genes, hojas de estilo o scripts de un dominio sin certificado ssl a uno con certificado o a tu propio servidor.<br \/>\n<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-family: Courier New; font-size: 10pt;\">&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;http:\/\/tunombrededominio.com\/estilo.css&#8221;&gt;<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: Courier New; font-size: 10pt;\">&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;\/\/tunombrededominio.com\/estilo.css&#8221;&gt;<br \/>\n<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-family: Times New Roman; font-size: 12pt;\">Selecciona <img decoding=\"async\" src=\"http:\/\/microgecko.com\/binnacle\/wp-content\/uploads\/2019\/03\/033119_0536_Modificacin4.png\" alt=\"\" \/> |<strong>Modificar las reglas de rewrite al activarse<\/strong> (desmarca esto cuando encuentres errores) y haz clic en el bot\u00f3n <strong>\u00a1Adelante, activa SSL!<\/strong><br \/>\n<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>Copiado de <a href=\"https:\/\/www.aemilius.net\/ayuda\/articulos\/redireccionar-pagina-web-http-https-ssl-automaticamente.html\">aemilius.\u00a0\u00a0 <\/a>Adaptado ARS<\/p>\n<p><a href=\"http:\/\/www.aemilius.net\/ir.php?url=http:\/\/www.aemilius.net\/alojamiento\/\"><span style=\"color: blue; font-family: Times New Roman; font-size: 12pt; text-decoration: underline;\"><br \/>\n<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Desde mayo de 2018, su sitio incluye certificado SSL, lo que significa que las p\u00e1ginas se pueden acceder por https y el correo entrante con SSL Se tom\u00f3 la iniciativa tras el anuncio de Google en el cual indicaban que Chrome ya no iba a abrir p\u00e1ginas que no tuvieran certificado. A la fecha (marzo [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/microgecko.isi.com.mx\/index.php?rest_route=\/wp\/v2\/posts\/927"}],"collection":[{"href":"https:\/\/microgecko.isi.com.mx\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/microgecko.isi.com.mx\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/microgecko.isi.com.mx\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/microgecko.isi.com.mx\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=927"}],"version-history":[{"count":2,"href":"https:\/\/microgecko.isi.com.mx\/index.php?rest_route=\/wp\/v2\/posts\/927\/revisions"}],"predecessor-version":[{"id":943,"href":"https:\/\/microgecko.isi.com.mx\/index.php?rest_route=\/wp\/v2\/posts\/927\/revisions\/943"}],"wp:attachment":[{"href":"https:\/\/microgecko.isi.com.mx\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=927"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/microgecko.isi.com.mx\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=927"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/microgecko.isi.com.mx\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}