/    Sign up×
Community /Pin to ProfileBookmark

getting to root dir

say i have page1.html in the path /root/folder1/folder2/
i have an images folder in /root/images
i want to link an image tag in page1.html to an image in the images folder in the root directory.
the only way i know now is to navigate back 2 times, which means <img src=”../../images/pic.gif”>
is there a way like any signs, which i can use to link directly to the root folder?
i thought <img src=”…/images/pic.gif”> would work but it doesnt.

to post a comment
HTML

7 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceJan 01.2005 — To go directly to the root folder, just start your relative URL with a slash:

src="/images/pic.gif"
Copy linkTweet thisAlerts:
@v_E_r5eauthorJan 01.2005 — i tried <img src="/img.php?id=1">

but it doesn't work...
Copy linkTweet thisAlerts:
@phpnoviceJan 01.2005 — It won't work locally (goes to the root of your harddrive), but it works from the Internet.
Copy linkTweet thisAlerts:
@v_E_r5eauthorJan 01.2005 — oh...i give it a try afterwards...thanks you ?
Copy linkTweet thisAlerts:
@v_E_r5eauthorJan 01.2005 — oh wait.....i am running apache on my computer now and is running from localhost url...even if it goes to the root dir, it is still the httpdocs folder isnt it?

or is it different from those web servers?
Copy linkTweet thisAlerts:
@FrozenDiceJan 01.2005 — localhost, 127.0.0.1, whatever its all just like a domain .com. The root folder in apache is htdocs which is refered to as / if you type in the domain then / you get the index.html from htdocs. Thus htdocs is the 'root' folder. When you have a folder directly in your htdocs folder its address would simply be /images, because / is root.
Copy linkTweet thisAlerts:
@v_E_r5eauthorJan 02.2005 — exactly what i was thinking...

but when i tried to put /photo.php?imgid=, it doesnt work. it only work when i put ../../photo.php
×

Success!

Help @v_E_r5e spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...