Re: [php-49] Absolute vs Relative Paths

From: Kris C.
Sent on: Tuesday, November 6, 2012 12:43 PM
Any of you guys remember Telnet?  As a fun experiment, use PuTTY or some other telnet client and connect to a webserver on port 80.  If memory serves, DOS command-line would look something like this:

C:\> telnet mydomain.com
GET /images/myimage.png


The domain name is used in the connection.  The absolute path is specified in the subsequent input.  I don't think specifying the full domain there is permitted by the protocol, but I could be wrong on that.  Either way, whatever the markup is in the HTML doesn't matter because the browser will format the HTTP request the same either way.

--Kris


On Tue, Nov 6, 2012 at 11:06 AM, Eric Harris <[address removed]> wrote:
Wow. Sounds like this topic is not nearly as cut and dry as I thought it would be.

So it sounds like there is really no performance difference between:
Ultimately they get handled the same exact way?

Thank you,

-- Eric


On Tue, Nov 6, 2012 at 10:24 AM, Bob Brunius <[address removed]> wrote:
I'm not sure that is correct. Once the browser has done a DNS look up to get the ip address of the domain doesn't it just use the ipaddress to make the request?

Bob


On Tue, Nov 6, 2012 at 10:12 AM, Joel Simpson <[address removed]> wrote:
Yes, the browser sends all resource requests to the server fully specified (e.g.  http://company.com/images/myimage.png) regardless of how they are described in the HTML.  An HTTP server is stateless so it doesn't know the context that the request is coming from.   If we asked the server GET "../../images.png" it wouldn't know where to pull it from.

Thanks,
Joel

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Joel Simpson | [address removed] 
cell: [masked]





On Tue, Nov 6, 2012 at 10:00 AM, Mark Steudel <[address removed]> wrote:
A side tangent, I always thought that:

src="/images/myimage.png"

Was called relative to the root.[1][2] (note I have no idea if these guys are right or not, but they seem to be saying the same thing)

[1] http://www.motive.co.nz/glossary/linking.php
[2] http://designisphilosophy.com/tutorials/html-basics-hyperlink-syntax-absolute-relative-and-root-relative/




On Tue, Nov 6, 2012 at 8:06 AM, George Marian <[address removed]> wrote:
The issues are slightly different if we're discussing relative/absolute paths as opposed to relative/absolute URLs.

Both of these are absolute:

src="/images/myimage.png"    vs    src="http://www.company.com/images/myimage.png"

The first is an absolute path, the second is an absolute URL.


My understanding is that there is an added cost to translating a relative path to an absolute path; at least in Apache.  When this cost becomes noticeable is another question.



On Mon, Nov 5, 2012 at 4:32 PM, Eric Harris <[address removed]> wrote:
Correct or at least that is where the original thread was intended to go. If everything you are linking to, is on your server, would or could you see any difference using relative paths vs absolute paths? (Relating to Performance)

-- Eric



On Mon, Nov 5, 2012 at 4:15 PM, Kris Craig <[address removed]> wrote:
So, wait.  Are we talking about the same resource on the same server, or are we talking about two separate resources being linked?  I thought this was about having a single file (like an image) hosted on your server, then linking to that from a webpage on the same server using either a relative URL or an absolute URL and measuring the performance difference between the two.

The stackoverflow post, however, is asking about whether it's faster to host a resource on a remote server or host it on the same server as the website.

--Kris


On Mon, Nov 5, 2012 at 4:10 PM, Mark Steudel <[address removed]> wrote:
This stackoverflow answer has some interesting information, don't know how valid it is since it's not footnoted ...
http://stackoverflow.com/a/5158862/212298


On Mon, Nov 5, 2012 at 3:56 PM, Joel Simpson <[address removed]> wrote:
I'm with you Kris, must be missing something.

are we talking about the difference between:

 src="/images/myimage.png"    vs    src="http://www.company.com/images/myimage.png"

If so, I think would be handled identically.  Both would end up fully resolved as "http://www.company.com/images/myimage.png" before being requested from the server.

Thanks,
Joel

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Joel Simpson | [address removed] 
cell: [masked]





On Mon, Nov 5, 2012 at 3:42 PM, Tim Piele <[address removed]> wrote:
No they have yo resolve on the server or else they won't make it to the browser.



Sent from my iPhone

On Nov 5, 2012, at 3:38 PM, Kris Craig <[address removed]> wrote:

Hmm I always thought resolution of relative paths happened at the browser level.  Or am I missing some context here?

--Kris


On Mon, Nov 5, 2012 at 3:02 PM, Jd Daniel <[address removed]> wrote:

Sounds legit

On Nov 5,[masked]:46 PM, "Eric Harris" <[address removed]> wrote:
Tim, that is half my job... don't know what I would do if I was not hotlinking every image I could get my hands on. ;)

I did not realize that absolute paths would require a new apache thread, but when I stop to think about that, it does make sense. So by using absolute paths on everything, images/page links/js includes, you are actually working your apache harder. Did I understand that correctly?

-- Eric

On Mon, Nov 5, 2012 at 2:37 PM, Tim Piele <[address removed]> wrote:
Quit hotlinking google images and that will fix it.




On Mon, Nov 5, 2012 at 2:35 PM, Garth Henson <[address removed]> wrote:
It is possible that this will make a difference, but it's generally negligible. Keep in mind that absolute links require an additional Apache process to resolve the domain name, etc. Relative links are handled in the same Apache process. So, if you have a TON of absolute URLs on your page, this could add up to a noticeable difference in latency to your page, but not to individual load times once the request has been made.

-GH


On Mon, Nov 5, 2012 at 2:20 PM, Eric Harris <[address removed]> wrote:
Hey Guys,

I am working on dealing with some slow loading images. I was suddenly struck with the thought of "Does absolute or relative paths, make a difference in load times?"

I did do some looking around, there are plenty of articles explaining the differences and such, but I could not find anything talking about load times, higher level pros/cons, or performance issues.

Anyone have an opinion on this topic?

Thanks,

-- Eric




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Eric Harris ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Eric Harris, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Garth Henson ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Garth Henson, visit his/her member profile





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Tim Piele ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Tim Piele, visit his/her member profile





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Eric Harris ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Eric Harris, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Jd Daniel ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Jd Daniel, visit his/her member profile





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Kris Craig ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Kris Craig, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Tim Piele ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Tim Piele, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Joel Simpson ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Joel Simpson, visit his/her member profile



--
-----------------------------------------
Mark Steudel
P: [masked]
F: [masked]
[address removed]

. : Work : .
http://www.mindfulinteractive.com
 
. : Play : .
http://www.steudel.org/blog

. : LinkedIn : .
http://www.linkedin.com/in/steudel





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Mark Steudel ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Mark Steudel, visit his/her member profile





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Kris Craig ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Kris Craig, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Eric Harris ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Eric Harris, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by George Marian ([address removed]) from The Seattle PHP Meetup Group.
To learn more about George Marian, visit his/her member profile



--
-----------------------------------------
Mark Steudel
P: [masked]
F: [masked]
[address removed]

. : Work : .
http://www.mindfulinteractive.com
 
. : Play : .
http://www.steudel.org/blog

. : LinkedIn : .
http://www.linkedin.com/in/steudel





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Mark Steudel ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Mark Steudel, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Joel Simpson ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Joel Simpson, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Bob Brunius ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Bob Brunius, visit his/her member profile





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Eric Harris ([address removed]) from The Seattle PHP Meetup Group.
To learn more about Eric Harris, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]

Our Sponsors

  • TUNE

    Meeting space and food

  • PluralSight

    PluralSight subscriptions for developer training

  • Siteground

    Information coming Soon

  • O'Reilly

    Disc Code: PCBW is good for 40% off print and 50% off ebooks and videos

  • JetBrains PhpStorm

    Occasional free licenses to raffle off at meetups

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy