Zen Cart Logo
Forums / General Questions / relative path start with slash?

relative path start with slash?

Locked

Views: 3,395

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
13 Aug 2008, 11:48 PM
#1
ebaobao avatar

ebaobao

Zen Follower

Join Date:
Jul 2008
Posts:
495
Plugin Contributions:
0

relative path start with slash?

Hello,
I've been coding with relative paths without the slash and everything is working great. Does anyone know if relative paths should start with a "/"

<a href="index.php?main_page=page1">

or

<a href="/index.php?main_page=page1">

which one is right or better?

13 Aug 2008, 11:59 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: relative path start with slash?

By definition, a relative path does not start with a slash. Starting with a slash makes it an "absolute" path instead of "relative".

ie: if your store was in a subfolder, starting with a slash would suggest the "root" of your webspace, which would not be the store if it's in a subfolder.

So ... unless you really mean "/", don't use it.