<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Petra Link Factory &#187; url limpias</title>
	<atom:link href="http://www.petralinkfactory.com/tag/url-limpias/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.petralinkfactory.com</link>
	<description>Programar no es un hobby es una pasión</description>
	<lastBuildDate>Sun, 15 Nov 2009 16:29:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>URL Amigables (y III) (ASP)</title>
		<link>http://www.petralinkfactory.com/2008/08/24/url-amigables-y-iii-asp/</link>
		<comments>http://www.petralinkfactory.com/2008/08/24/url-amigables-y-iii-asp/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 10:05:33 +0000</pubDate>
		<dc:creator>Valde</dc:creator>
				<category><![CDATA[programación]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[url limpias]]></category>

		<guid isPermaLink="false">http://www.petralinkfactory.com/?p=8</guid>
		<description><![CDATA[Bueno, lo del retraso va a ser lo usual en mi por lo que parece, pero entre que he estado muy liado con un proyecto grande y que en medio he estado de vacaciones he tardado un poco en escribir esta entrada. En esta entrada, que en principio será la última de las URL Amigables, [...]]]></description>
			<content:encoded><![CDATA[<p>Bueno, lo del retraso va a ser lo usual en mi por lo que parece, pero entre que he estado muy liado con un proyecto grande y que en medio he estado de vacaciones he tardado un poco en escribir esta entrada.</p>
<p>En esta entrada, que en principio será la última de las URL Amigables, vamos a ver cómo implementarlas en ASP 3.0 sobre IIS, como mi hosting es PHP no puedo poner ningún ejemplo on-line, pero si pondré un ejemplo comprimido en formato zip para que lo podáis probar en vuestro IIS.</p>
<p>Al igual que en php lo que vamos a utilizar para simuar el módulo ReWrite de Apache es usar la página de error 404. Para ello lo que hay que hacer es crear el sitio web en el IIS. Luego editamos el sitio web, para ello pulsamos con el botón derecho sobre el sitio web y accedemos a las propiedades del sitio web. Una vez que estamos en las propiedades del sitio web, pincha sobre la carpeta de errores personalizados. Allí deberás de cambiar todos los errores que se generan con el error 404, generalmente hay 3 (al menos en el IIS6 de Windows 2003, que es yo utilizo). La url que debes poner es /controllers/controller.asp (para mi ejemplo, en otro caso deberás poner el fichero que desees). Como puedes ver es lo mismo que hice en PHP.</p>
<p>Ahora ya solo nos queda procesar la URL y dirigirnos al módulo necesario.</p>
<div class="igBar"><span id="lasp-2"><a href="#" onclick="javascript:showPlainTxt('asp-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">ASP:</span>
<div id="asp-2">
<div class="asp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">&lt;%</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">'&nbsp; Vamos a averiguar el controlador que se nos ha pedido.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">strController = <span style="color:#990099; font-weight:bold;">replace</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#990099; font-weight:bold;">Request</span>.<span style="color:#330066;">QueryString</span>, <span style="color:#CC0000;">"404;http://localhost/urlamigables:80/"</span>, <span style="color:#CC0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">aControl = <span style="color:#990099; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span>strController, <span style="color:#CC0000;">"/"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Control = <span style="color:#CC0000;">""</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Param = <span style="color:#CC0000;">""</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">If</span> <span style="color:#990099; font-weight:bold;">IsArray</span><span style="color:#006600; font-weight:bold;">&#40;</span>aControl<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#0000FF; font-weight:bold;">And</span> <span style="color:#990099; font-weight:bold;">UBound</span><span style="color:#006600; font-weight:bold;">&#40;</span>aControl<span style="color:#006600; font-weight:bold;">&#41;</span>&amp;gt; <span style="color:#800000;color:#800000;">0</span> <span style="color:#990099; font-weight:bold;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Control = aControl<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Session</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"ParamController"</span><span style="color:#006600; font-weight:bold;">&#41;</span> = <span style="color:#990099; font-weight:bold;">Replace</span><span style="color:#006600; font-weight:bold;">&#40;</span>strController, aControl<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span> &amp;amp; <span style="color:#CC0000;">"/"</span>, <span style="color:#CC0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">'&nbsp; No es array, con lo que no hay ninguna barra y el strController es el control.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Control = strController</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Session</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"ParamController"</span><span style="color:#006600; font-weight:bold;">&#41;</span> = <span style="color:#CC0000;">""</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">End</span> <span style="color:#990099; font-weight:bold;">If</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Select</span> <span style="color:#990099; font-weight:bold;">Case</span> <span style="color:#990099; font-weight:bold;">LCase</span><span style="color:#006600; font-weight:bold;">&#40;</span>Control<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Case</span> <span style="color:#CC0000;">"modulo1"</span> :</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Server</span>.<span style="color:#330066;">Execute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"modulo1.asp"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Case</span> <span style="color:#CC0000;">"modulo2"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Server</span>.<span style="color:#330066;">Execute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"modulo2.asp"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Case</span> <span style="color:#990099; font-weight:bold;">Else</span> :</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">Server</span>.<span style="color:#330066;">Execute</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"404.asp"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#990099; font-weight:bold;">End</span> <span style="color:#990099; font-weight:bold;">Select</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF; font-weight:bold;">%&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
puedes ver es lo mismo que hice en PHP</p>
<p>Bueno básicamente ya solo quedan los ficheros de los módulos y el fichero de acciones, que no tienen mucho que ver, los podéis ver en el zip con todos los ficheros necesarios.</p>
<p><a title="Descarga el ejemplo" href="http://www.petralinkfactory.com/docs/urlamigable-asp.zip">Fichero Zip</a> con un ejemplo de las url amigales.</p>
<p>Pues ya está acabada esta serie de 3 artículos sobre las URLs Amigables. Espero que mi próximo artículo no se espacie mucho en el tiempo, pero es que estoy muy liado, hay veces que estoy muy ocioso, y otras veces me salen 3 trabajos a la vez, y no los puedo rechazar.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.petralinkfactory.com/2008/08/24/url-amigables-y-iii-asp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>URLs Amigables (I)</title>
		<link>http://www.petralinkfactory.com/2008/04/27/urls-amigables-i/</link>
		<comments>http://www.petralinkfactory.com/2008/04/27/urls-amigables-i/#comments</comments>
		<pubDate>Sun, 27 Apr 2008 07:33:13 +0000</pubDate>
		<dc:creator>Valde</dc:creator>
				<category><![CDATA[programación]]></category>
		<category><![CDATA[truco]]></category>
		<category><![CDATA[url limpias]]></category>

		<guid isPermaLink="false">http://www.petralinkfactory.com/?p=5</guid>
		<description><![CDATA[En la actualidad el uso de URLs Amigables (o en inglés SEO URLs) se está expandiendo mucho puesto que Google te indexa mejor en las búsquedas. En este post voy a explicar cómo hacer lo de las URLs amigables sin utilizar el módulo de Apache Rewrite y sin necesidad de ningún componente (para IIS). Para [...]]]></description>
			<content:encoded><![CDATA[<p>En la actualidad el uso de <strong>URLs Amigables </strong><em>(o en inglés SEO URLs)</em> se está expandiendo mucho puesto que Google te indexa mejor en las búsquedas.</p>
<p>En este post voy a explicar cómo hacer lo de las URLs amigables sin utilizar el módulo de <em>Apache Rewrite</em> y sin necesidad de ningún componente (para IIS).</p>
<p>Para empezar lo primero que tenemos que ver qué son las URLs amigables. Estas URLs son las direcciones pero sin parámetros. Por ejemplo este post tiene una dirección que es http://www.petralinkfactory.com/2008/04/27/url-amigables-i. Una URL "no amigable" sería http://www.petralinkfactory.com/?post=1234 (no creo que esta dirección funcione puesto que la he puesto de ejemplo).</p>
<p>El truco que voy a explicar es para programar nuestras propias páginas webs, para WordPress el propio sistema nos permite seleccionar las URLs amigables en las configuraciones de los post.</p>
<p>Ya que no tenemos el módulo Rewrite disponible, bien por que estamos en un hosting compartido (que ya es raro que ocurra) o bien puesto que nuestro hosting es Windows sobre IIS, el truco es usar una pequeña zapuza, el <strong>error 404</strong>.</p>
<p>Entonces el fichero de error 404 va a ser el encargado de recoger la url y hacer las acciones pertinentes para ejecutar la página que corresponda.</p>
<p>Esta técnica de usar el error 404 no es recomendable para gente que ya tenga programado un sitio web entero, puesto que tendréis que cambiar todas las páginas webs que querráis que tengan URL limpias, para adaptarlas a la forma de trabajar de las URL amigables.</p>
<p>Para la programación de las páginas públicas yo lo que hago es analizar la url de manera que a cada módulo de la web (agenda, noticias, secciones de texto, ...) le asigno un "controlador", que no es más que el nombre del módulo, para luego seguir con los "parámetros" que van a ser necesario para dicho módulo.</p>
<p>En el siguiente capítulo empezaré a poner ejemplos de código.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.petralinkfactory.com/2008/04/27/urls-amigables-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
