?
Solved

Passing query strings within a query string

Posted on 1998-07-19
2
Medium Priority
?
156 Views
Last Modified: 2013-12-25
/cgibin/redirect.cgi?url=http://www.digitalriver.com/dr/v2/ec_Main.Entry?SP=10007&SID=6370&CID=0

When I run the above script to redirect on link, the query string in the url to be redirected to seems to get cut off at the =. How can I solve this?
0
Comment
Question by:djschaper
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 28

Expert Comment

by:sybe
ID: 1830840
use urlencode to encode the querystring, for example with Javascript escape()
0
 
LVL 6

Accepted Solution

by:
alamo earned 200 total points
ID: 1830841
When you run a redirect like this, you can't use standard QUERY_STRING processing in your redirect script, because the query string in the redirected url has to be decoded at the final destination, not by you. If you urlencode the querystring your cgi has to decode and then reencode or information will be lost- it's quite tricky, and can easily fail. And it's unnecessary.

The easy way to do it is to change the url to:

/cgibin/redirect.cgi?http://www.digitalriver.com/dr/v2/ec_Main.Entry?SP=10007&SID=6370&CID=0

notice the url= part is gone. Now, in redirect.cgi don't do any QUERY_STRING processing at all, just do the redirect (shown in perl, if you are using something else the idea is the same):

print "Location: $ENV{QUERY_STRING}\n\n";

If you really must have additional fields encoded as part of your redirect url, either place them at the start of the QUERY_STRING and process them specially, or put them into PATH_INFO so they are separate.

Hope this helps!
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question