Welcome to WebmasterWorld Guest from 54.166.46.226

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)

5+ Year Member



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 Jun 19, 2007 (gmt 0)

5+ Year Member



<!--#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 Jun 20, 2007 (gmt 0)

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



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

Jim