Forum Moderators: phranque

Message Too Old, No Replies

Server Side Include File Name Path Problem:

shtml, server side include, server side filen

         

downtownpets

5:47 pm on Aug 26, 2010 (gmt 0)

10+ Year Member



Hi,

I am using server side include files on some of my web pages. My problem seems to be occurring with the file path address.

Example:

I have a web page that is located in:

root > sub-folder

example: example-site.com/sub-folder/example-page.shtml

what I'd like to do obviously is have the include file be:

root > inc

Making the include file address: /inc/example.shtml

But the only way I can seem to get the include file to work is when I put a folder named "inc" in the sub-folder, so:

root > sub-folder > inc

Making the include file address: inc/example.shtml

Can someone help me with this please so I can just make one include file that will effect all the pages in my sub-folders. I thought just putting a backslash before inc would direct it to root but not working, thank you and please let me know if I can provide anything else or if this doesn't make any sense.

jdMorgan

8:21 pm on Aug 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What is the purpose of this sub-folder? Why does it exist and/or why do you use it? Is this an "add-on domain" or an "add-on" subdomain defined with a Control Panel?

If so, then it will be impossible for this add-on (sub)domain to access resources above its DocumentRoot, defined by the Control panel as "/subfolder/"

If this "add-on" scenario is not what you're doing on your server, then your problem is highly unusual, and points to a server configuration error...

Jim

downtownpets

9:32 pm on Aug 26, 2010 (gmt 0)

10+ Year Member



Hi, thank you for your comments.

The subfolders are necessary because they are existing and I can't play with my present file structure.

I should clarify, maybe better explain my issue:

This seems to be an issue of having one include file work for pages not in my root folder. I have read on the internet different code you can add that helps cover all pages in root folder or not but these all seem to apply to .php files and not.shtml files...

jdMorgan

10:57 pm on Aug 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What you have should work fine, basically. Because it does not work, something else is wrong.

Any path that starts with a slash means, "Start at the DocumentRoot" -- as defined in the server configuration. So if /inc/example-page.shtml is referenced in an include, but resolves to <DocumentRoot>/sub-folder/inc/example-page.shtml instead of <DocumentRoot>/inc/example-page.shtml, then either your server configuration is faulty, or it is simply not configured the way that you think it is... That is why I asked about the "Control Panel add-ons" above.

[added] Here is the code I use to include a footer on all pages of one of my sites, regardless of what subdirectory the page's file might be located in:

<!--#include virtual="/ftr_lmn.htm" -->

[/added]

Jim