bcf004854091600aa279525d6772e1827114d39dnd<?xml version="1.0" encoding="UTF-8" ?>
bcf004854091600aa279525d6772e1827114d39dnd<!DOCTYPE manualpage SYSTEM "/style/manualpage.dtd">
bcf004854091600aa279525d6772e1827114d39dnd<?xml-stylesheet type="text/xsl" href="/style/manual.es.xsl"?>
bbcc277fef0330ac4c1f937cb0dea78248225c0ahumbedooh<!-- English Revision: 420990:1361157 (outdated) -->
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd<!--
d209ecb5fe6393098ebb1f1afeea3648b1bf89eafielding Licensed to the Apache Software Foundation (ASF) under one or more
d209ecb5fe6393098ebb1f1afeea3648b1bf89eafielding contributor license agreements. See the NOTICE file distributed with
d209ecb5fe6393098ebb1f1afeea3648b1bf89eafielding this work for additional information regarding copyright ownership.
d209ecb5fe6393098ebb1f1afeea3648b1bf89eafielding The ASF licenses this file to You under the Apache License, Version 2.0
d209ecb5fe6393098ebb1f1afeea3648b1bf89eafielding (the "License"); you may not use this file except in compliance with
d209ecb5fe6393098ebb1f1afeea3648b1bf89eafielding the License. You may obtain a copy of the License at
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd http://www.apache.org/licenses/LICENSE-2.0
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd Unless required by applicable law or agreed to in writing, software
bcf004854091600aa279525d6772e1827114d39dnd distributed under the License is distributed on an "AS IS" BASIS,
bcf004854091600aa279525d6772e1827114d39dnd WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
bcf004854091600aa279525d6772e1827114d39dnd implied. See the License for the specific language governing
bcf004854091600aa279525d6772e1827114d39dnd permissions and limitations under the License. -->
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd<manualpage metafile="custom-error.xml.meta">
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <title>Respuestas de error personalizadas</title>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <summary>
bcf004854091600aa279525d6772e1827114d39dnd <p>Apache ofrece la posibilidad de que los webmasters puedan
bcf004854091600aa279525d6772e1827114d39dnd configurar las respuestas que muestra el servidor Apache cuando se
bcf004854091600aa279525d6772e1827114d39dnd producen algunos errores o problemas.</p>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>Las respuestas personalizadas pueden definirse para activarse
bcf004854091600aa279525d6772e1827114d39dnd en caso de que el servidor detecte un error o problema.</p>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>Si un script termina de forma anormal y se produce una respuesta
bcf004854091600aa279525d6772e1827114d39dnd "500 Server Error", esta respuesta puede ser sustituida por otro
bcf004854091600aa279525d6772e1827114d39dnd texto de su elecci&#243;n o por una redirecci&#243;n a otra URL
bcf004854091600aa279525d6772e1827114d39dnd (local o externa).</p>
bcf004854091600aa279525d6772e1827114d39dnd </summary>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <section id="behavior">
bcf004854091600aa279525d6772e1827114d39dnd <title>Comportamiento</title>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <section>
bcf004854091600aa279525d6772e1827114d39dnd <title>Comportamiento anterior</title>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>NCSA httpd 1.3 devolv&#237;a mensajes antiguos del error o
bcf004854091600aa279525d6772e1827114d39dnd problema encontrado que con frecuencia no ten&#237;an
bcf004854091600aa279525d6772e1827114d39dnd significado alguno para el usuario, y que no inclu&#237;an en
bcf004854091600aa279525d6772e1827114d39dnd los logs informaci&#243;n que diera pistas sobre las causas de
bcf004854091600aa279525d6772e1827114d39dnd lo sucedido.</p>
bcf004854091600aa279525d6772e1827114d39dnd </section>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <section>
bcf004854091600aa279525d6772e1827114d39dnd <title>Comportamiento actual</title>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>Se puede hacer que el servidor siga uno de los siguientes
bcf004854091600aa279525d6772e1827114d39dnd comportamientos:</p>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <ol>
bcf004854091600aa279525d6772e1827114d39dnd <li>Desplegar un texto diferente, en lugar de los mensajes de
bcf004854091600aa279525d6772e1827114d39dnd la NCSA, o</li>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <li>redireccionar la petici&#243;n a una URL local, o</li>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <li>redireccionar la petici&#243;n a una URL externa.</li>
bcf004854091600aa279525d6772e1827114d39dnd </ol>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>Redireccionar a otra URL puede resultar de utilidad, pero
bcf004854091600aa279525d6772e1827114d39dnd solo si con ello se puede tambi&#233;n pasar alguna
bcf004854091600aa279525d6772e1827114d39dnd informaci&#243;n que pueda explicar el error o problema y/o
bcf004854091600aa279525d6772e1827114d39dnd registrarlo en el log correspondiente m&#225;s claramente.</p>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>Para conseguir esto, Apache define ahora variables de entorno
bcf004854091600aa279525d6772e1827114d39dnd similares a las de los CGI:</p>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <example>
bcf004854091600aa279525d6772e1827114d39dnd REDIRECT_HTTP_ACCEPT=*/*, image/gif, image/x-xbitmap,
bcf004854091600aa279525d6772e1827114d39dnd image/jpeg<br />
bcf004854091600aa279525d6772e1827114d39dnd REDIRECT_HTTP_USER_AGENT=Mozilla/1.1b2 (X11; I; HP-UX A.09.05
bcf004854091600aa279525d6772e1827114d39dnd 9000/712)<br />
bcf004854091600aa279525d6772e1827114d39dnd REDIRECT_PATH=.:/bin:/usr/local/bin:/etc<br />
bcf004854091600aa279525d6772e1827114d39dnd REDIRECT_QUERY_STRING=<br />
bcf004854091600aa279525d6772e1827114d39dnd REDIRECT_REMOTE_ADDR=121.345.78.123<br />
bcf004854091600aa279525d6772e1827114d39dnd REDIRECT_REMOTE_HOST=ooh.ahhh.com<br />
bcf004854091600aa279525d6772e1827114d39dnd REDIRECT_SERVER_NAME=crash.bang.edu<br />
bcf004854091600aa279525d6772e1827114d39dnd REDIRECT_SERVER_PORT=80<br />
bcf004854091600aa279525d6772e1827114d39dnd REDIRECT_SERVER_SOFTWARE=Apache/0.8.15<br />
bcf004854091600aa279525d6772e1827114d39dnd REDIRECT_URL=/cgi-bin/buggy.pl
bcf004854091600aa279525d6772e1827114d39dnd </example>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>Tenga en cuenta el prefijo <code>REDIRECT_</code>.</p>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>Al menos <code>REDIRECT_URL</code> y
bcf004854091600aa279525d6772e1827114d39dnd <code>REDIRECT_QUERY_STRING</code> se pasar&#225;n a la nueva
bcf004854091600aa279525d6772e1827114d39dnd URL (asumiendo que es un cgi-script o un cgi-include). Las otras
bcf004854091600aa279525d6772e1827114d39dnd variables existir&#225;n solo si exist&#237;an antes de aparecer
bcf004854091600aa279525d6772e1827114d39dnd el error o problema. <strong>Ninguna</strong> de estas variables
bcf004854091600aa279525d6772e1827114d39dnd se crear&#225; si en la directiva <directive
bcf004854091600aa279525d6772e1827114d39dnd module="core">ErrorDocument</directive> ha especificado una
bcf004854091600aa279525d6772e1827114d39dnd redirecci&#243;n <em>externa</em> (cualquier cosa que empiece
bcf004854091600aa279525d6772e1827114d39dnd por un nombre de esquema del tipo <code>http:</code>, incluso si
bcf004854091600aa279525d6772e1827114d39dnd se refiere al mismo servidor).</p>
bcf004854091600aa279525d6772e1827114d39dnd </section>
bcf004854091600aa279525d6772e1827114d39dnd </section>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <section id="configuration">
bcf004854091600aa279525d6772e1827114d39dnd <title>Configuraci&#243;n</title>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>El uso de <directive module="core">ErrorDocument</directive>
bcf004854091600aa279525d6772e1827114d39dnd est&#225; activado para los ficheros .htaccess cuando <directive
bcf004854091600aa279525d6772e1827114d39dnd module="core">AllowOverride</directive> tiene el valor
bcf004854091600aa279525d6772e1827114d39dnd adecuado.</p>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>Aqu&#237; hay algunos ejemplos m&#225;s...</p>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <example>
bcf004854091600aa279525d6772e1827114d39dnd ErrorDocument 500 /cgi-bin/crash-recover <br />
bcf004854091600aa279525d6772e1827114d39dnd ErrorDocument 500 "Sorry, our script crashed. Oh dear" <br />
bcf004854091600aa279525d6772e1827114d39dnd ErrorDocument 500 http://xxx/ <br />
bcf004854091600aa279525d6772e1827114d39dnd ErrorDocument 404 /Lame_excuses/not_found.html <br />
bcf004854091600aa279525d6772e1827114d39dnd ErrorDocument 401 /Subscription/how_to_subscribe.html
bcf004854091600aa279525d6772e1827114d39dnd </example>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>La sintaxis es,</p>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <example>
bcf004854091600aa279525d6772e1827114d39dnd ErrorDocument &lt;3-digit-code&gt; &lt;action&gt;
bcf004854091600aa279525d6772e1827114d39dnd </example>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>donde action puede ser,</p>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <ol>
bcf004854091600aa279525d6772e1827114d39dnd <li>Texto a mostrar. Ponga antes del texto que quiere que se
bcf004854091600aa279525d6772e1827114d39dnd muestre unas comillas ("). Lo que sea que siga a las comillas se
bcf004854091600aa279525d6772e1827114d39dnd mostrar&#225;. <em>Nota: las comillas (") no se
bcf004854091600aa279525d6772e1827114d39dnd muestran.</em></li>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <li>Una URL local a la que se redireccionar&#225; la
bcf004854091600aa279525d6772e1827114d39dnd petici&#243;n.</li>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <li>Una URL externa a la que se redireccionar&#225; la
bcf004854091600aa279525d6772e1827114d39dnd petici&#243;n.</li>
bcf004854091600aa279525d6772e1827114d39dnd </ol>
bcf004854091600aa279525d6772e1827114d39dnd </section>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <section id="custom">
bcf004854091600aa279525d6772e1827114d39dnd <title>Mesajes de error personalizados y redirecciones</title>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>El comportamiento de Apache en cuanto a las redirecciones ha
bcf004854091600aa279525d6772e1827114d39dnd cambiado para que puedan usarse m&#225;s variables de entorno con
bcf004854091600aa279525d6772e1827114d39dnd los script/server-include.</p>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <section>
bcf004854091600aa279525d6772e1827114d39dnd <title>Antiguo comportamiento</title>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>Las variables CGI est&#225;ndar estaban disponibles para el
bcf004854091600aa279525d6772e1827114d39dnd script al que se hac&#237;a la redirecci&#243;n. No se inclu&#237;a
bcf004854091600aa279525d6772e1827114d39dnd ninguna indicaci&#243;n sobre la precedencia de la
bcf004854091600aa279525d6772e1827114d39dnd redirecci&#243;n.</p>
bcf004854091600aa279525d6772e1827114d39dnd </section>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <section>
bcf004854091600aa279525d6772e1827114d39dnd <title>Nuevo comportamiento</title>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>Un nuevo grupo de variables de entorno se inicializa para que
bcf004854091600aa279525d6772e1827114d39dnd las use el script al que ha sido redireccionado. Cada
bcf004854091600aa279525d6772e1827114d39dnd nueva variable tendr&#225; el prefijo <code>REDIRECT_</code>.
bcf004854091600aa279525d6772e1827114d39dnd Las variables de entorno <code>REDIRECT_</code> se crean a
bcf004854091600aa279525d6772e1827114d39dnd partir de de las variables de entorno CGI que existen antes de
bcf004854091600aa279525d6772e1827114d39dnd la redirecci&#243;n, se les cambia el nombre
bcf004854091600aa279525d6772e1827114d39dnd a&#241;adi&#233;ndoles el prefijo <code>REDIRECT_</code>, por
bcf004854091600aa279525d6772e1827114d39dnd ejemplo, <code>HTTP_USER_AGENT</code> pasa a ser
bcf004854091600aa279525d6772e1827114d39dnd <code>REDIRECT_HTTP_USER_AGENT</code>. Adem&#225;s, para esas
bcf004854091600aa279525d6772e1827114d39dnd nuevas variables, Apache definir&#225; <code>REDIRECT_URL</code>
bcf004854091600aa279525d6772e1827114d39dnd y <code>REDIRECT_STATUS</code> para ayudar al script a seguir su
bcf004854091600aa279525d6772e1827114d39dnd origen. Tanto la URL original como la URL a la que es redirigida
bcf004854091600aa279525d6772e1827114d39dnd la petici&#243;n pueden almacenarse en los logs de acceso.</p>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>Si ErrorDocument especifica una redirecci&#243;n local a un
bcf004854091600aa279525d6772e1827114d39dnd script CGI, el script debe incluir una campo de cabeceraa
bcf004854091600aa279525d6772e1827114d39dnd "<code>Status:</code>" en el resultado final para asegurar que
bcf004854091600aa279525d6772e1827114d39dnd es posible hacer llegar al cliente de vuelta la condici&#243;n
bcf004854091600aa279525d6772e1827114d39dnd de error que lo provoc&#243;. Por ejemplo, un script en Perl
bcf004854091600aa279525d6772e1827114d39dnd para usar con ErrorDocument podr&#237;a incluir lo
bcf004854091600aa279525d6772e1827114d39dnd siguiente:</p>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <example>
bcf004854091600aa279525d6772e1827114d39dnd ... <br />
bcf004854091600aa279525d6772e1827114d39dnd print "Content-type: text/html\n"; <br />
bcf004854091600aa279525d6772e1827114d39dnd printf "Status: %s Condition Intercepted\n", $ENV{"REDIRECT_STATUS"}; <br />
bcf004854091600aa279525d6772e1827114d39dnd ...
bcf004854091600aa279525d6772e1827114d39dnd </example>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>Si el script tiene como fin tratar una determinada
bcf004854091600aa279525d6772e1827114d39dnd condici&#243;n de error, por ejemplo
bcf004854091600aa279525d6772e1827114d39dnd <code>404 Not Found</code>, se pueden usar los
bcf004854091600aa279525d6772e1827114d39dnd c&#243;digos de error y textos espec&#237;ficos en su lugar.</p>
bcf004854091600aa279525d6772e1827114d39dnd
bcf004854091600aa279525d6772e1827114d39dnd <p>Tenga en cuenta que el script <em>debe</em> incluir un campo
bcf004854091600aa279525d6772e1827114d39dnd de cabecera <code>Status:</code> apropiado (como
bcf004854091600aa279525d6772e1827114d39dnd <code>302 Found</code>), si la respuesta contiene un campo de
bcf004854091600aa279525d6772e1827114d39dnd cabecera <code>Location:</code> (para poder enviar una
bcf004854091600aa279525d6772e1827114d39dnd redirecci&#243;n que se interprete en el cliente). De otra
bcf004854091600aa279525d6772e1827114d39dnd manera, la cabecera
bcf004854091600aa279525d6772e1827114d39dnd <code>Location:</code> puede que no tenga efecto.</p>
bcf004854091600aa279525d6772e1827114d39dnd </section>
bcf004854091600aa279525d6772e1827114d39dnd </section>
bcf004854091600aa279525d6772e1827114d39dnd</manualpage>
bcf004854091600aa279525d6772e1827114d39dnd