<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>Il giorno 15/ago/06, alle ore 23:41, Martino di Filippo ha scritto:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite">Ho capito dove sta il problema.<BR>Inoltre, c'è almeno un errore, seppur triviale, oltre al fatto che non capisco bene l'uso di [^/] (perchè mai usare "un carattere diverso da /" quando l'id non è terminato da "/"? visto che l'url è nella forma test/ID.html, sarebbe più corretto usare [^\.]+\.html) <BR></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>questo tipo di regola l'avevo presa da un tutorial su un forum, che era data come prova per verificare il funzionamento del rewrite.. non mi sono soffermato troppo sulla correttezza dell'espressione :P</DIV><BR><BLOCKQUOTE type="cite">Comunque, venendo al nocciolo della questione, il browser mostra il nuovo indirizzo perchè stai dando un url completo di http:// come rewrite, dovresti usare un url relativo alla directory corrente:<BR><BR>RewriteRule test/(\d+)\.html text.php?id$1<BR class="khtml-block-placeholder"></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>ok, in effetti tutti fanno riferimento a questo tipo di regole (senza url completo), però in realtà se non specifico l'url completo lui mi da un 404.</DIV><DIV>Cmq con la tua regola chiedendo la pagina </DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;"><A href="http://localhost/~massimo/prova_rewrite/test/mondo.html">http://localhost/~massimo/prova_rewrite/test/mondo.html</A></SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">ottengo:</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">Not Found</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">The requested URL /~massimo/prova_rewrite/test/mondo.html was not found on this server.</SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">invece con la regola precedente:</SPAN></FONT></DIV><DIV>RewriteRule test/([^/]+).html test.php?id=$1 [L]<FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;"></SPAN></FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;"><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">richiamando: <FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;"><A href="http://localhost/~massimo/prova_rewrite/test/mondo.html">http://localhost/~massimo/prova_rewrite/test/mondo.html</A></SPAN></FONT></SPAN></FONT></SPAN></FONT></DIV><DIV><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;"><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 13px;">mi restituisce:</SPAN></FONT></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">Not Found</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">The requested URL /Users/massimo/Sites/prova_rewrite/test.php was not found on this server.</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" size="3"><SPAN class="Apple-style-span" style="font-size: 12px;">nel primo caso non riscrive, nel secondo invece il path sarebbe corretto perchè il file test.php è proprio in quella directory, solo che lo traduce in path e non in url</SPAN></FONT></DIV><DIV><BR><BLOCKQUOTE type="cite">(Nota che il . prima di html, se non preceduto da un backslash, indica "un carattere qualsiasi" e non un punto effettivo. L'espressione funziona comunque perchè un punto è "un carattere qualsiasi", ma tanto vale essere precisi. <BR>In più, visto che gli id sono numerici, puoi usare \d+ (che indica una serie di cifre) al posto di [^/]+.)<BR class="khtml-block-placeholder"></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>capito!<BR><BR><BLOCKQUOTE type="cite">Spero che sia tutto chiaro!<BR>Martino<BR></BLOCKQUOTE><BR></DIV>byez<BR><DIV>max</DIV></BODY></HTML>