PDA

View Full Version : SSI include problems



fed.linuxgossip
14th April 2007, 01:22 PM
Hello,

When I use
<!--#include virtual="http://www.exampleURL/inc.html"--> as the include tag in a index page there is an error: [an error occurred while processing this directive]


root@server1 [~]# tail -f /usr/local/apache/logs/error_log

Fri Apr 13 20:14:50 2007] [error] [client IP] unable to include
"http://www.exampleURL/inc.html" in parsed file /home/naw572/public_html/index.html


Now, instead if I use the follwing as include tag
<!--#include virtual="/inc.html"-->

SSI works properly ( I need to copy inc.html to /home/naw572/public_html/ in this case ).


Please advise how can I get the include tag working with
<!--#include virtual="http://www.exampleURL/inc.html"-->.


Additional Server Details
===========================

root@server1 [~]# cat /home/naw572/public_html/.htaccess
Options +Includes
AddType text/html .html
AddHandler server-parsed .html
root@server1 [~]#



/etc/httpd/conf/httpd.conf
=========================
AddType text/html .shtml
AddType text/html .html

#
# To use server-parsed HTML files
#
#AddType text/html .shtml
AddHandler server-parsed .shtml
AddHandler server-parsed .html




Thanks

schwim
14th April 2007, 04:21 PM
As a security measure, incredibly few server setups will allow you to include pages via a domain, instead insisting on relative url's and paths(like your working instance). The risk of abuse and destruction to your webserver is too great, so all good setups have this disabled by default.

thanks,
json

fed.linuxgossip
14th April 2007, 04:40 PM
Thank you for your reply... the concerned URL to be included is on the same server...... what setting manipulations can give us a workaround for this?

Please advise.


Thanks.

schwim
14th April 2007, 04:41 PM
I was looking around the triple dubya to see if I could find a workaround for you, and I can't find a way to get Apache to allow global URL's via SSI. I've not used SSI in a very long time, so I can't tell you for sure whether it's possible to do or not, but it's looking like a no-go.

Your best bet to include a global URL is to use php with CURL or a comparable module.

thanks,
json

schwim
14th April 2007, 05:02 PM
Hey there:

If the file you're attempting to include resides in the same file system, you would use a relative path to get to it:



<!--#include virtual="file.txt"-->


grabs a file that's sitting in the same directory.



<!--#include virtual="../file.txt"-->


grabs a file that sitting one directory up.



<!--#include virtual="../../sub/file.txt"-->


grabs a file that's sitting in a subdir called sub two directories up from the file calling the SSI

I hope this helps! :D

thanks,
json

fed.linuxgossip
14th April 2007, 06:03 PM
Hi,

I am aware of the relative path on the same filesystem.... I would have still liked if I could (or someone) advise the other option.

fed.linuxgossip
14th April 2007, 06:03 PM
Thanks a lot for your kind help :)

schwim
14th April 2007, 06:07 PM
Hi there,

My point in all of this is that I don't think there is another option when dealing with SSI, unless I'm misunderstanding your question. You either use a relative path, or you don't use SSI. This is what I gather from apache.org and the support groups.

thanks,
json

fed.linuxgossip
14th April 2007, 06:08 PM
Ok... I got your point... thanks for all your help.