Welcome to WebmasterWorld Guest from 50.17.114.227

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Server Side Includes - Paths, Directories

Paths, directory, SSI

     
7:32 pm on Jun 19, 2007 (gmt 0)

New User

5+ Year Member

joined:June 17, 2007
posts:26
votes: 0


On my server I have a directory and file located here that I want to access - /public_html/ads/728-468x90-60.txt

Index.shtml is in the public_html directory of my server. If I put a server side include in index.shtml that asks for a txt file from /public_html/ads, it will look like this....

<!--#include file="./ads/728-468x90-60.txt"-->

And it works great. Now........

I have another directory with a file in it located at /public_html/windows2003/start.htm. I want to put an SSI in start.htm and it will look like this....or so I thought...

<!--#include file="../ads/728-468x90-60.txt"-->
<!--#include file="/public_html/ads/728-468x90-60.txt"-->
<!--#include file="../../ads/728-468x90-60.txt"-->
<!--#include file="./ads/728-468x90-60.txt"-->
<!--#include file="/./ads/728-468x90-60.txt"-->

But none of these paths enable me to get the same file from /public_html/ads/. Plus I have tried many more. Does anyone know how to access this file from this location? Or know how to access directories with SSIs? Paths, to me, are strange with SSIs.

10:02 pm on June 19, 2007 (gmt 0)

New User

5+ Year Member

joined:June 17, 2007
posts:26
votes: 0


<!--#include file="../ads/728-468x90-60.txt"-->

It looks like using virtual (below) instead of file (above) will do the trick. I did a search on the forums and found the solution. I did a search before I posted but wasn't patient enough. The code below works.

<!--#include virtual="/ads/728-468x90-60.txt"-->

4:51 am on June 20, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Glad you got it figured out -- "include virtual" is recommended for most applications.

Jim