Forum Moderators: phranque

Message Too Old, No Replies

server side includes and linking to a file in a subdirectory

         

matimer

1:31 am on Apr 18, 2005 (gmt 0)

10+ Year Member



I've never been able to use server side includes (*.shtml) and link to a subdirectory.

here is what i want to be able to do:
<!--#include file="/subdirectory/file.htm" -->

Here is the error I get:
[an error occurred while processing this directive]

Any help would be awesome

matimer

sitz

11:28 am on Apr 18, 2005 (gmt 0)

10+ Year Member



Anything interesting in your error log?

jd01

11:42 am on Apr 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You might need to enable/define what file extention(s) should be processed as ssi... most hosting companies allow this through a domian set-up or something similar.

Mine is in a 'hosting parameters' option, where I can add or delete extensions to be considered for each protocol, then they are written to my httpd.conf file.

Justin

Span

11:45 am on Apr 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you want to include a file that is in another directory you should use
<!--#include virtual=" .. instead of <!--#include file=" ..

matimer

1:03 pm on Apr 18, 2005 (gmt 0)

10+ Year Member



I tried replacing file with virtual like Span said:
<!--#include virtual=" .. instead of <!--#include file=" ..

I tried the full name [site.com...]
I tried... /directory/file.htm
and... directory/file.htm

and none worked... anyone got any ideas why?

Thanks,

matt

matimer

4:16 pm on Apr 18, 2005 (gmt 0)

10+ Year Member



A couple other issues involved that could be causing the error.

The link the server side include is attempting to find is a mod rewritten .php file.

Example used to be includes=file.php (not exact) and now is file.htm.

Could this be causing the problem? With server side includes can you link out to a php file?

THanks for any help,

matimer

jdMorgan

5:45 pm on Apr 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Server-side includes are not performed using an HTTP request -- the action takes place entirely within the server. Therefore, the included path must specify a local file, not a URL-path.

Jim

matimer

6:20 pm on Apr 18, 2005 (gmt 0)

10+ Year Member



Thanks for all the help, I switched the files back to the original php files and the server side includes work.

However, the only issue now is that the images aren't showing up b/c they are no longer pointing to the proper directory. Is there a simple way to change all the files using some kinda mod rewrite, so that they point to a subdirectory instead of the root directory?