<?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 Jan 2012 09:14:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.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 &#8230; <a href="http://www.petralinkfactory.com/2008/08/24/url-amigables-y-iii-asp/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></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 &#8230; <a href="http://www.petralinkfactory.com/2008/04/27/urls-amigables-i/">Sigue leyendo <span class="meta-nav">&#8594;</span></a>]]></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>

