Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: CGI Image on localhost

by exussum0 (Vicar)
on Dec 21, 2003 at 22:42 UTC ( [id://316256]=note: print w/replies, xml ) Need Help??


in reply to CGI Image on localhost

Typically with apache, you have your cgi's in a sperate directory than you static, non-program, content. You have that straight. What you would typically do is have your images refered as http://machinename/images/image.jpg

You can use .., but you'd probably use ../images/image.jpg. That's a relative url. Relative url's are nice usually, but it's a matter of opinion what people like more :)

Remember, for browsers, its typically nicer to use /'s instead of \'s.


Play that funky music white boy..

Replies are listed 'Best First'.
Re: Re: CGI Image on localhost
by eoin (Monk) on Dec 21, 2003 at 23:14 UTC
    Cheers thats what I was looking for, however will <quote>relative urls</quote> work under windows eviroments e.g. the windows servers??

    Merry Christmas, Eoin...

    If everything seems to be going well, you obviously don't know what the hell is going on.

      All in all, apache should do the right thing with slashes.

      Here's a long winded explanation on why it's fine...

      Let's put it this way. When you click on a link in a browser, it's supposed to issue an http request to the server based on the href. If the href has ../../../ etc, it will strip a few directories in the request. LIkewise if you do ../tmp/../tmp/../tmp. That's basic directory resolving in any os (replace /'s with \'s).

      So if you are at http://www/somedir/somedir2 and clicked a link http="../", you'll ask for http://www/somedir , if you clicked http="../somedir2/../somedir2" it should request http://www/somedir2/../somedir2. That is a guess. It may recompress it back to http://somedir/somedir2, but that's somethign to test and play with. not very useful :)

      Anyway, the browser should try and compress it somewhat, turning initial ../'s back into something shorter. The request is sent to the server and it can interpret it ANY WAY it wants. Doing something like /cgi-bin/this.cgi/that will pass that as an argument to your this.cgi script. This is a feature of the server 'cause it parses it that way. Well, at least apache did last i checked :) Anyway, last check, apache on windows should translate http://blah/this/../that/ int c:\whereyouinstalledapache\htdocs\this\..\that, which should turn into c:\whereyouinstalledapache\htdocs\that.


      Play that funky music white boy..
        ya wha??
        Took me a while but i think I get it now. Cheers.
        Nollaig Shona, Eoin...

        Nollaig shona duit.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://316256]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-04-16 16:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found