Can a CGI Script Read URL in Browser and Redirect Accordingly?

Can a CGI Script Read URL in Browser and Redirect Accordingly?

Post by Farada » Tue, 31 Oct 2000 13:22:17



Well, here is what I want to do:

I have a virtual server and two other domains pointing to it.
Naturally, I would like to point them to files other than the main
index file. So, here is the question:
Assume that I have domains alpha.com and beta.com pointing
to gamma.com. This means that alpha.com/ and alpha.com/index.html
go automatically to gamma.com/index.html. The same for beta.com.
Can the index.html file on gammma.com recognize that the user
is actually coming from alpha.com (of beta.com) and redirect him/her
accordingly? It would be nice to send all allpha.com (beta.com)
users to a file other than the main index file of gamma.com.
Could a CGI script called from .htaccess or the HTML-file do it?
Thanks!

Dennis

 
 
 

Can a CGI Script Read URL in Browser and Redirect Accordingly?

Post by Miguel Cr » Tue, 31 Oct 2000 11:35:14



> Assume that I have domains alpha.com and beta.com pointing
> to gamma.com. This means that alpha.com/ and alpha.com/index.html
> go automatically to gamma.com/index.html. The same for beta.com.
> Can the index.html file on gammma.com recognize that the user
> is actually coming from alpha.com (of beta.com) and redirect him/her
> accordingly?

The environment variable $HTTP_POST is set by Apache and will be available
to your CGI to base its decisions on.

miguel

 
 
 

Can a CGI Script Read URL in Browser and Redirect Accordingly?

Post by Miguel Cr » Tue, 31 Oct 2000 11:35:40



> The environment variable $HTTP_POST

Sorry, typo, that's $HTTP_HOST

miguel

 
 
 

1. URL Redirect with CGI Scripts

Hi everybody,

I have one problem that I'm unable to solve. On of our users has a html page
that starts a cgi script with the following command:

<form action="http://www.server.somewhere/cgi-bin/konfig.cgi"method=post
enctype="text/plain">

On the Server there is a redirect via .htaccess like this:

RewriteEngine on
RewriteBase   /cgi-bin
RewriteRule   ^test\.cgi$ http://www2.server.somewhere/cgi-bin/konfig.acgi

The redirect basicly works fine. The problem is the following:

Using the form with MS Explorer from Windows or Macintosh via the redirect
sends the information in the form correctly to the script.

Using the form with Netscape Navigator from Windows or Macintosh via the
redirect sends no information in the form to the script. The script is
called without any data.

But using the form with Netscape Navigator from Windows or Macintosh caling
the script directly sends the information in the form correctly to the
script.

So, what happens with the data when Netscape runs over the redirect??? I
tried the redirect with apache 1.2.4 and Roxen Challenger - The same
situation. MS works, Netscape not.

I think the problem is in the combination of the POST and ENCTYPE statement
in the form. Unfortunately the form is generated with the Macromedia
Director and is already sent on CD-ROM to the customers. So there is no way
to change the form....

Anybody any hint???

--

Wolfgang Boenschen

2. Q: howto make glibc-1.09

3. How to redirect any URL to one particular CGI script?

4. signal handling & sockets

5. How to redirect any URL to one particular CGI script ???

6. Strange: it all works, but sendmail doesn't run

7. httpd.conf: ServerAlias changes URL in Browser (redirect instead of alias)

8. Problems with FreeBSD2.2.2 and Samba

9. How to force browsers to display virtual (redirected) URLs ?

10. redirecting user based on current URL in browser window

11. Netscape CGI redirect needs full URL?

12. Canned Proxy URLs to Filter

13. Netscape Commerce Server (Redirecting URLs and URL Aliases)