logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache, relative URLs, and ../
Author
daivddd



Joined: 17 Aug 2015
Posts: 2
Location: San Diego, CA

PostPosted: Mon 24 Aug '15 0:03    Post subject: Apache, relative URLs, and ../ Reply with quote

I'm learning about relative URLs in HTML on my Apache server. I'm able to pull up sites at the localhost fine. I'm now learning about <img src...> and I'm having trouble with ../ to reach an image at a relatively higher directory. localhost is C:\Apache Software Foundation\Apache2.2\htdocs.

I first put the image into the htdocs folder alongside index.html and it's retrieved OK at localhost/index.html with <img src="image.jpg">. I thought that by using ../ I could then retrieve the file at the Apache2.2 directory, but it doesn't seem to work. I can move the image to every directory above htdocs and keep the <img> tag the same at <img src="image.jpg> and I can retrieve the image each time. Also if I stack ../ together without moving the image I can still retrieve it just fine. It's the same whether I use localhost or literal directory names.

What about Apache, relative URLs, and ../ don't I understand?
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Mon 24 Aug '15 6:43    Post subject: Reply with quote

URLs are relative to the DocumentRoot but for security reasons cannot go above the DocumentRoot.

http://httpd.apache.org/docs/2.2/urlmapping.html
1st paragraph says as much but it also explains options for getting around it.
Back to top


Reply to topic   Topic: Apache, relative URLs, and ../ View previous topic :: View next topic
Post new topic   Forum Index -> Apache