• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

formating links on a web site

steven_d02

n00b
Joined
Feb 15, 2005
Messages
51
What is the best way or prefered way of formating links for your website. Shoulds they be

relative such as : href="../folder/files.html"
absolute href="http://www.blah.com/folder/files.html"
or based from root href="/folder/files.html"

or is this really a matter of personnel preference? Thanks for you input.
 
I think it comes down to how you implement your site and what the page is linking to. Just use what's best.

e.g. if you're linking to a page within the same domain, it might not be necessary to do an absolute link and so a relative one would work.

Alternately, if you know that same piece of markup will be used across multiple domains, to keep the markup portable, you'd probably want to go with an absolute link. A common example would be links on pages within domains containing SSL support.

--KK
 
relative off the root is best, since it's domain independent. Also, some web servers (IIS for sure) can have "parent paths" disabled for security reasons, meaning ../ links will not work.
 
My links are relative based on the site root.

Take, for example, the index page of my website and you will see how the links are formed.

Each page, take example, this one (source), the SITE_ROOT is the number of parent directories to the root of the website. On that page a is a link using a relative link up two directories into the meta directory targetting the style.css.

I find that this relative mechanism, while it can be improved drastically, works for me. :)
 
Another vote for relative as well.

One major disadvantage to absolute IMO is that you can't easily test your internal links off-line, you would need to upload your pages to test them. And if you're "in development" and don't want the spiders crawling before you're ready to go live, you have to make a point of excluding them. Just seems like a pain to me.
 
Absolute links are cool on a production server, but you might just wanna do something like
Code:
<?="http".(($_SERVER['HTTPS']=="on")? "s" : "")."://".$_SERVER["HTTP_HOST"]."/"?>path/to/stuff

to make your links so you don't have to go changing stuff from server to server, and it should have you covered when you go into https:// so you don't get that annoying "This webpage is displaying both secure and non-secure..." warning message


***EDIT***
But in the end I use pathways relative to root cause relative pathways are a pain in the butt (but I admit more diverse especially if your root web dir isn't /)
 
Back
Top