[Hyperlinks] Relative or Full Paths?

Conrad11 said:
Hi there,

When people are doing hyperlinks do they use relative or full paths?

Any advantage of either?

Thanks.
advantage of full links is google might pick them up as references. happened to my old site and resulted in a higher google rating! :D

but i generally use relative on my newest site.
 
Conrad11 said:
Surely that is irrelivant, cause you would have to change the links anyways if you move it?
No. A lot of people tend to (whether this is good practice or not, I have no idea) set a global variable as the document root (e.g. www.websitename.com/applicationname/) then use relative URLs within the application itself. That way all one has to do when moving the application around is redefine the global document root variable.

I tend to use relative URLs, then play around with CSS2 (I think it is) to display absolute URLs in print-outs :)
 
Al Vallario said:
No. A lot of people tend to (whether this is good practice or not, I have no idea) set a global variable as the document root (e.g. www.websitename.com/applicationname/) then use relative URLs within the application itself. That way all one has to do when moving the application around is redefine the global document root variable.
I do a slightly modified version of this :)
 
Conrad11 said:
Surely that is irrelivant, cause you would have to change the links anyways if you move it?

No, if you code it so you don't need to change the URLs then you won't have to.

e.g.

Code:
$include "includes/hello.php";

When you move the script this will not need to be re-coded, if you used this:

Code:
$include "http://www.blah.com/includes/hello.php";

The above would need to be recoded.
---------------------------------------------------
A better example:

Code:
<a href="index.php">Home</a>

Wouldn't need to be recoded but this would:

Code:
<a href="http://www.site.com/index.php">Home</a>
 
Back
Top Bottom