Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: HTTP Silent Redirect

From: tim-johnsons::web::com at: 23-Sep-2008 8:28

On Monday 22 September 2008, vonja-sbcglobal.net wrote:
> Hello Rebol List, > > I'm attempting to do a "silent" http redirect via REBOL > rather than an Apache mod_rewrite. > > In Apache it could be written as: > RewriteRule ^secret_crush_prank/?$ > /var/chroot/html/go/secret_crush_prank.html [NC,L] > > If the client visited http://www.domain.com/secret_crush_prank > the client would be silently redirected to another page without > seeing the new URI location in the Address bar of the browser. >
Hello Vonja: I'm not sure just what your end use is, and I'm a bit confused about what you mean by "silent redirect" because to me the term seems to be an oxmoron. So follows two code snippets: one for a redirect: ( in python, but easy to translate to rebol) def js_redirect(S,emit=None): """Compose a javascript redirection.""" R = '<SCRIPT language="JavaScript">window.location="%s"</script>' % S if emit: print R else: return R that should translate to something like (untested) reb-redirect: func[URL][print rejoin[{<SCRIPT language="JavaScript">window.location="} URL {</script>}] But if you were doing something like a "silent get url" - like the silentposturl method used by credit card authorizers, as an example - here's an idea employing the rebol command line and another script on my desktop:
>> res: read
http://bart.johnson.com/cgi-bin/baker/reb/baker.r/execute?task=List-Queries ;;Capturing the output from the script in the 'res variable suppresses any ;;output and if I look at baker.dbg (the debug log for baker.r), I see that both the 'execute' path part and the 'task' name/value pair have been logged. Does either of these help? regards tim