4

I was told by my hosting provider's technical people that I should be using relative file paths (/home/index.php) instead of absolute paths (http://www.example.com/index.php) to "reduce server load".

His words:

[logs showing that my domain name is a popular 'referrer' for page loads]

This is the vast majority of your hits. Since this is your own website the sole reason this referrer is generating this traffic is because you are using absolute url's in your code rather than relative paths.

Please speak to your web developer and have him change ALL absolute urls in your code to relative paths. This will make your code portable and it will reduce the load. I don't believe this site really needs a [dedicated] server. This is just a case of you driving the traffic to yourself with poor coding practice. Please fix this.

Can someone please explain to me how this makes any sense, if it does? The page in question is a sign-up form, and it uses an absolute-pathed PHP header(Location) to refer traffic once it's passed validation and stored in the database. I can see how relative paths would make my code more portable, if I were to change domain names, but either way it's requesting the same data from the same server.

Thanks so much for the help, I'm really puzzled over this! The tech guy who sent this isn't answering my followups.

1 Answers1

0

Both links take you to the same page, but there's a big difference in the way they perform. By using a relative path, the browser knows to just look within your own web site's server space for the linked file. However, if you use the absolute path, the browser goes back out onto the Internet and finds your site all over again, then finds the file within your directory. So, if you're linking to pages on your own site, using a relative path will make your site respond quicker. It's all about speed!

If you're linking to something off your site, then you must use the absolute path because there is no relative path to use.

Blames to Mr Boogie Jack