<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-15"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<h2>Trovato in rete e vi faccio un copia ed incolla. <br>
</h2>
<p>One of the biggest complaints about AJAX, that I hear, is that it&#8217;s
difficult to escape your own domain (actually host, protocol and port)
It&#8217;s easy enough to use an <a href="http://www.w3.org/2006/webapi/"
 title="W3C do web services" target="_blank">XHR object</a> to retrieve
an XML document (or whatever) from within your own domain but a soon as
you try to get an <a href="http://blogs.law.harvard.edu/tech/rss"
 title="RSS definitive guide" target="_blank">RSS</a> feed or access a <a
 href="http://en.wikipedia.org/wiki/Representational_State_Transfer"
 title="Wikipedia REST page" target="_blank">REST</a> service on
another box your stuffed.</p>
<p>Well you might not be quite as stuffed as you thought. I hope this
helps those of you who think .htaccess is only good for redirects and
adding passwords.</p>
<p>If you use Apache as your web server, and I&#8217;m sure you are (although
other web servers may be just as good or better) you&#8217;ll hopefully know
about <a href="http://httpd.apache.org/docs/1.3/howto/htaccess.html"
 title="Apache tutorial page" target="_blank">.htaccess</a> files. If
you don&#8217;t they are plain text files that tell apache to do stuff before
returning the page.</p>
<p>There is a little feature of Apache called mod_rewrite. It&#8217;s a
rule-based rewriting engine to rewrite requested URLs on the fly. It
can be used to make your URLs pretty but here it&#8217;s going to act as our
proxy.</p>
<p>First create a file called .htaccess with the following code.</p>
<p class="code">RewriteEngine on<br>
RewriteRule ^/call/(.*)$ <a class="moz-txt-link-freetext" href="http://backstage.bbc.co.uk/$1">http://backstage.bbc.co.uk/$1</a> [P]</p>
<p>Then all you need to do is on your server create a folder called
&#8220;bbc&#8221; or whatever. Upload this file to it and that folder will act as a
proxy server to your AJAX application. Nice, Job done and only two
lines of code.</p>
<pre class="moz-signature" cols="72">-- 
Michel 'ZioBudda' Morelli                       <a class="moz-txt-link-abbreviated" href="mailto:michel@ziobudda.net">michel@ziobudda.net</a>
Consulenza sistemistica in ambito OpenSource.
Sviluppo applicazioni web dinamiche (LAMP+Ajax)
Telefono: +39-3939890025 --  Fax: +39-0291390660

<a class="moz-txt-link-freetext" href="http://www.ziobudda.net">http://www.ziobudda.net</a>                         ICQ: 58351764  
<a class="moz-txt-link-freetext" href="http://www.ziobuddalabs.it">http://www.ziobuddalabs.it</a>                      Skype: zio_budda
<a class="moz-txt-link-freetext" href="http://www.ajaxblog.it">http://www.ajaxblog.it</a>                                MSN: <a class="moz-txt-link-abbreviated" href="mailto:michel@ziobuddalabs.it">michel@ziobuddalabs.it</a>                   
</pre>
</body>
</html>