Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Anyone familiar with problems with <!--#include
virtual="filename.asp"--> with ASP files on an Apache server?

It's supposed to be an improvement on <!--#include
file="filename.asp"--> since the latter is only meant to work in the
directory it is located in whilst the former can be used with any
include file on the domain. At least that's what the documentation
I've read says.

So you add <!--#include file="filename.asp"--> to a file and it will
search that directory and include the file filename.asp. I've found
you can also add ../ to go to the parent directory as well (though
some documentation says this shouldn't work).

If you use <!--#include virtual="/filename.asp"--> or say <!--#include
virtual="/ssi/filename.asp"--> it will search the root of the domain
for that file (or folder like ssi). The benefit being you can have
thousands of pages in various folders all include the same file from
the folder "SSI" (or other folder of your choice) rather than having
to include it in ever folder.

Sounds great, except I can't get include virtual to work!

When I add <!--#include file="filename.asp"--> it works fine (using it
on 60,000 pages. But when I use <!--#include
virtual="/ssi/filename.asp"--> it fails and the above text is left in
the end file (as seen by a browser)!

Everything I've read says it shouldn't do that.

Anyone some across this problem before or an idea why it's not

Also is it possible to include a file from another domain? I've tried
the obvious without success.


http://www.search-engine-optimization-services.co.uk /

Re: OT:

On Sat, 11 Sep 2004 00:06:04 GMT, SEO Dave

Quoted text here. Click to load it

Dave, you may want to ask this over on alt.www.webmaster - SpaceGirl
and a couple other regulars there are pretty knowledgeable about ASP
and frequent that NG more so than this one.


Re: OT:

daveSP@AMsearch-engine-optimization-services.co.uk> writes
Quoted text here. Click to load it


I'm using <!--#include virtual="../directory-name/file-name.html" -->
within .shtml pages to include a navigation bar at the top of 700+ pages
within one of my sites (not the one in my sig), and no problems, so it
can work. Mind you, the files I'm including are .html and the
'container' pages are .shtml, so don't know if that makes a difference.


Jane Patience - The Friendly-Places Team
Friendly Accommodation in the UK and Ireland


Hi Dave

I think the problem you're getting is that if you are using virtual, it does
not use the root of your site but the actual root of the server

If you wish to use virtual (which I do for my all of my PHP includes), use
something like

<!--#include virtual="/path/to/your/website/directory/filename.asp"-->


<!--#include virtual="/www/docs/classic-literature/filename.asp"-->

That should work fine for you Dave ;-)

I usually place variables such as filepath in a seperate "account.inc" file
and include that at the top of each page.

Then it's easy to reference virtual files by simply using something like

<!--#include virtual="<filepath variable>/filename.asp"-->

Graham Jones
Free vouchers and Discount Codes

Quoted text here. Click to load it


You can use a link from another domain when using the include feature.

I bought this script for ten bucks that explains it and also the
script enables you to only include what you want to when "grabbing"
text, articles, etc. from another page to add to yours.



Site Timeline