HTTP Silent Redirect
[1/3] from: vonja:sbcglobal at: 22-Sep-2008 22:46
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. I found the following on a Rebol archive but it only does a standard redirect. I've been trying to add different status codes to redirect silently but no success. --------------------------------------------------- REBOL  http-redir: func [url] [ print join "Location: " url print join "Expires: 0" newline ] http-redir http://www.domain.com/go/secret_crush_prank ---------------------------------------------------- Any suggestions? Thank you for your help in advance.
[2/3] from: hallvard::ystad::babelserver::org at: 23-Sep-2008 8:33
Hi Vonja, A silent redirect actually isn't a redirect. It's simply Apache serving some other document for the script. So if you have two files: 1.r and 2.r and when you get a request for 1.r, and you'd like to redirect silently to 2.r, you'll just have to serve 2.r (and not say anything about it to the browser). There is no way for the browser (at least not for the browsers I know) to show another URI than the actual one in the address bar. Here's a sample (not tested!): replace incoming-url "1.r" "2.r" print read next find incoming-url "/" # remove leading slash first .. So you actually don't mess with the headers. If you prefer to do the rewrite in a script made for that intent only, Apache will let you do the rewrite processing with a rebol script: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritemap The apache directive would look something like this: RewriteMap to2-map prg:/path/to/map.1to2.r Hope this helps, HY Dixit vonja-sbcglobal.net (07.46 23.09.2008):
[3/3] 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
<<quoted lines omitted: 5>>> the client would be silently redirected to another page without > seeing the new URI location in the Address bar of the browser.
>> 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
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted