|
|
|
|
![]() ![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [MODERATOR]
Posts: 4,433 Joined: 24-July 05 From: Linix, DOS and Windows…the good, the bad and the ugly Member No.: 9,787 ![]() myCENT:74.90 |
Post
#1
Nov 20 2005, 03:27 AM
When referencing a file or pix inside an html file, there are absolute references, relative references and server absolute references. I think I am okay with the first two kinds, but have a question about server absolute. Assume I have a subdomain of the Trap17 named subdomain. In the subdomain, I have a public_html folder which contains the files accessible from the web, so if in one of those files, lets say it is located in a folder named folder1 and is inside the public-html, I insert a "server absolute reference", does the reference begin at the public_html folder?. CODE Location of file: public_html/folder1/file1 for a server absolute reference: /folder1/file1 Is this correct? Or does the referencing begin above the public_html folder? [note=jlhaslip]Edit to insert bbcode[/note] This post has been edited by jlhaslip: Nov 20 2005, 03:30 AM |
![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 123 Joined: 5-September 05 Member No.: 11,522 |
Post
#2
Nov 20 2005, 04:18 AM
I believe that the absolute reference should be starting with the public_html folder, so your code would be correct. Maybe you should do a test to find out...
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 1,161 Joined: 9-May 05 From: Brisbane, QLD Member No.: 6,818 |
Post
#3
Nov 20 2005, 07:07 AM
On Apache servers you can append your path to $_SERVER['docroot'] which equals public_html/folder1/file1 etc for whatever box you're hosted on.
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 873 Joined: 30-July 04 Member No.: 246 |
Post
#4
Nov 20 2005, 10:20 AM
The DocumentRoot directory is where all public content is served from. On a correctly configured, secure and reliable server (such as Apache), it is impossible to access anything at or above the level of that directory. Referencing '/public_html/file' for client-side usage will result in the sever attempting to serve '/your/home/path/public_html/public_html/file', if that makes sense. When using server-side languages, however - such as PHP - you have to remember that the paths are relative to the server, not the DocumentRoot directory, so '/file' is literally '/file' in the root directory of the current hard disk. When internally referencing other files within a script (such as via PHP's include() or require() functions), you should always prefix it with $_SERVER['DOCUMENT_ROOT'] so as to ensure the correct file is being accessed. |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 1,161 Joined: 9-May 05 From: Brisbane, QLD Member No.: 6,818 |
Post
#5
Nov 20 2005, 10:27 PM
QUOTE(Spectre @ Nov 20 2005, 08:20 PM) When internally referencing other files within a script (such as via PHP's include() or require() functions), you should always prefix it with $_SERVER['DOCUMENT_ROOT'] so as to ensure the correct file is being accessed. Which is what I just said. It should be pointed out, however, that using $_SERVER['DOCUMENT_ROOT'] is not a reliable method when running PHP on IIS. |
![]() ![]() |
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
0 | OpaQue | 676 | 9th September 2004 - 08:40 AM Last post by: OpaQue |
|||
![]() |
5 | outwarsecrets | 601 | 16th August 2004 - 06:40 AM Last post by: stephenob |
|||
![]() |
9 | Panzer | 758 | 4th January 2007 - 08:52 PM Last post by: fffanatics |
|||
![]() |
7 | Raptrex | 596 | 27th August 2004 - 11:16 PM Last post by: Spectre |
|||
![]() |
3 | NuHoaXuLa | 649 | 17th November 2006 - 08:33 AM Last post by: farsiscript |
|||
![]() |
0 | sekundar | 756 | 26th July 2006 - 07:35 AM Last post by: sekundar |
|||
![]() |
1 | truvu17 | 493 | 21st September 2004 - 09:12 AM Last post by: OpaQue |
|||
![]() |
0 | aoehq | 1,101 | 17th March 2007 - 06:20 AM Last post by: aoehq |
|||
![]() |
0 | Bimboadmasministries | 598 | 8th October 2004 - 11:45 AM Last post by: Bimboadmasministries |
|||
![]() |
0 | Bimboadmasministries | 471 | 8th October 2004 - 11:55 AM Last post by: Bimboadmasministries |
|||
![]() |
10 | newbie_dhkt | 585 | 2nd January 2009 - 11:46 AM Last post by: triplebtalk |
|||
![]() |
4 | sithslayer | 390 | 14th December 2008 - 02:29 PM Last post by: sithslayer |
|||
![]() |
4 | DMA | 435 | 29th October 2004 - 07:50 PM Last post by: odomike |
|||
![]() |
1 | champ_rock | 623 | 15th July 2006 - 09:01 AM Last post by: BuffaloHELP |
|||
![]() |
0 | jackkkk26 | 613 | 12th November 2004 - 12:47 PM Last post by: jackkkk26 |
|||
|
Open Discussion | Time is now: 8th January 2009 - 09:11 AM |