?
Solved

Does LOCATION: http://  Work?

Posted on 1997-11-12
6
Medium Priority
?
173 Views
Last Modified: 2013-12-25
I am using the following line in my CGI-PERL code:

print "Location: http://mywebsite.com/test.htm\n\n";

This is the ONLY line I have that outputs back to browser.  From what I've gathered, this should tell the browser to switch to this new web site (mywebsite.com/test.htm).  Unfortunately it doesn't do this.  

All I get is DOCUMENT CONTAINS NO DATA (or something to that extent) by Netscape 4.0 and down and MS Explorer.

Any clues as to what I'm doing wrong?
0
Comment
Question by:jujoo
[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
  • 3
  • 2
6 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1831153
Perhaps the http://mywebsite.com/test.htm document contains no data?
Or perhaps some other line in your program is preventing the only output line from printing.
0
 
LVL 3

Accepted Solution

by:
gwalters earned 0 total points
ID: 1831154
One more newline ought to do it (an HTTP header is delimited by a blank line).

BTW, I hope you're planning on increasing the points before grading this.
0
 
LVL 6

Expert Comment

by:alamo
ID: 1831155
Funny, looks like there's a blank line after the Location header to me...

jujoo, if you run the script from the commasd line what does it print? That might tell you something.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 3

Expert Comment

by:gwalters
ID: 1831156
Oops, I didn't look closely enough.  Now that I have, I see the real problem.  Try printing this:


"Location: http://mywebsite.com/test.htm\r\n\r\n"



You MUST use CR LF at the end of lines in HTTP.


0
 
LVL 6

Expert Comment

by:alamo
ID: 1831157
Must? I have never used \r\n and have seen only a handful of examples which do, almost everything I've seen uses just \n. I've never had a problem. (The server is repsonsible for parsing the headers anyway). Is this server-dependent?
0
 
LVL 3

Expert Comment

by:gwalters
ID: 1831158
OK, "must" (especially with my all-caps emphasis) might have been a bit strong.  I meant it was in the HTTP spec as CR LF.

I beleive most servers see the LF coming in from a CGI and convert them to CR LF.

Could we get a URL to check so we can stop guessing here (and I can stop making bold statements that turn out to be wrong ;)


0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
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 while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

770 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