Connecting Tech Pros Worldwide Forums | Help | Site Map

url forward with query string

Adrian
Guest
 
Posts: n/a
#1: Dec 6 '05
Hi
is it possible (if so how) to do a redirect / url forward with query
string

i.e.
www.test1.com?pram1=a?pram2=b

is forwarded to
www.test2.com?pram1=a?pram2=b

Thanks



Randy Webb
Guest
 
Posts: n/a
#2: Dec 6 '05

re: url forward with query string


Adrian said the following on 12/6/2005 7:15 AM:[color=blue]
> Hi
> is it possible (if so how) to do a redirect / url forward with query
> string[/color]

Yes it is possible.
How? Add the query string to the URL before redirecting.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dennis Ålund
Guest
 
Posts: n/a
#3: Dec 6 '05

re: url forward with query string


Use either
header("Location: http://www.test2.com"._SERVER["REQUEST_URI"]);
before anything is written to the document(!) as soon as the first
headers are sent to the browser this won't work.

Or you can have a redirect meta tag in <head> looking like this:
<meta http-equiv='Refresh'
content='0;http://www.test2.com<?=_SERVER["REQUEST_URI"]?>'>
The digit 0 (zero) before the semicolon in 'content' tell the browser
to redirect with 0 seconds delay... which you can change if you want to
display "You are now redirected to test2"

The choice depends a little on when redirection is supposed to happen.

web.dev
Guest
 
Posts: n/a
#4: Dec 6 '05

re: url forward with query string



Adrian wrote:[color=blue]
> Hi
> is it possible (if so how) to do a redirect / url forward with query
> string
>
> i.e.
> www.test1.com?pram1=a?pram2=b
>
> is forwarded to
> www.test2.com?pram1=a?pram2=b
>
> Thanks[/color]

In addition to the solutions above, you can also do the following in
javascript:

location.href = "www.test2.com?pram1=a&pram2=b";

Closed Thread