From: Jim Weirich Date: 2006-05-25T02:10:41+09:00 Subject: Re: Cgi output problem. Javier Valencia wrote: > I've been using mod_ruby for months and now i have to write a script > that redirects my users to another location. > I use the following: > > #!/bin/env ruby > > print "Location: http://www......com/index.html\r\n\r\n" > > > Well, this script doesn't work for me. It just prints as plain text the > Location statement and no redirection is done. > Now, if i change the extension of the script from ".rb" to ".cgi" it > works! > > I did a telnet research to my server, and the .cgi returned a 302 > status, but the ".rb" returned a 200 OK and two content-type statements, > as if the server is ignoring them or something. You need to inform your web-server (apache I assume, since you are talking about mod_ruby) that .rb files are valid CGI scripts (in addition to .cgi). It sounds like it is treating them as data files and displaying them instead of running them. Or you can just make all your cgi scripts end in .cgi. -- Jim Weirich -- Posted via http://www.ruby-forum.com/.