Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Passing query strings within a query string

Posted on 1998-07-19
2
Medium Priority
?
157 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
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 the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

618 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