How did I get server side includes working?
May 10, 2006 4:56 PM   Subscribe

Regarding this previous MeFi thread, how did I get server side includes to work?

A random Googler (who doesn't have a MeFi account) came across the thread above, and someone privately e-mailed me with the solution to the problem with BlueHost and server side includes. This person is having the same problem. I lost the e-mail that told me how I got it to work. Anyone want to venture a guess as to how I got server side includes working?

The links from the previous thread to my HTML and CSS files are still valid.
posted by IndigoRain to Computers & Internet (9 answers total) 1 user marked this as a favorite
So, they suddenly stopped working? You deleted your files? What changed? You never even mention in the thread what code you settled on. You point to your example HTML, but if there's any code in them, it's executed before we can see it.

Sound like a great question for your webhost's helpdesk. That's part of the reason you pay them.
posted by deadfather at 6:01 PM on May 10, 2006

First off, it is often the case that server-side includes (which are a subset of a certain kind of server-side scripting) are only enabled for some file extensions. On my server, I have it set up so that it only runs on files with the extension ".shtml". You need to find out what file extensions have this enabled on your server.

Second, in your file you place the following code:

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

Because of the "virtual" keyword, the path starts with a slash and gives the full path from the web root to the file. If you use the "file=" keyword instead, then it has to be a relative path, which I found to be too much of a pain to bother with.

Here's the official documentation on all this, but like nearly all "open source" documentation it obscures more than it clarifies.
posted by Steven C. Den Beste at 7:04 PM on May 10, 2006

Response by poster: Okay first of all, no, nothing stopped working, but she has copied my syntax in her code and it's still working. Secondly, as I mentioned in the other thread, I don't have access to our webhost helpdesk, as it's a shared account and I don't have a password for the bluehost account, only my own FTP account.

I know I didn't have to change anything like enabling it for html files because I don't have a password to do so!

I am using virtual instead of file, but she tried that and it isn't working for her.

I'm just trying to help out a stranger since whoever e-mailed me before obviously got it to work but I can't remember a thing about what they said.
posted by IndigoRain at 8:42 PM on May 10, 2006

Response by poster: still *not* working - for her.
posted by IndigoRain at 8:42 PM on May 10, 2006

Probably that function isn't enabled on her server. It's not a default capability; it has to be explicitly enabled by the hosting provider.

(Since I own my own server and thus am my own hosting provider, that wasn't an issue for me.)
posted by Steven C. Den Beste at 10:42 PM on May 10, 2006

What's her hosting company?

That's the only way we can find out.
posted by AmbroseChapel at 11:44 PM on May 10, 2006

Response by poster: Bluehost bluehost bluehost and it can't be that it's not enabled, because whatever fix I used didn't require me to enable it because I don't have a password!

Am I repeating myself here?!
posted by IndigoRain at 6:47 PM on May 11, 2006

Sorry, it wasn't clear if it was you or someone else who was on bluehost. I've just spent some time searching their helpdesk and knowledgebase site and there's no mention of "server-side includes" or "SSI" or "shtml" anywhere. It looks as if that's not a service they provide.

It seems from the other thread that you may have solved it by using PHP instead of HTML files?
posted by AmbroseChapel at 10:47 PM on May 11, 2006

Response by poster: Okay, here is her final reply:

the problem turned out to be that because I was using .shtml for the includes files, I needed to make every page using those files a .shtml as well, and NOT .html. I would have NEVER figured that out. Tech support figured it out. I think you never ran into that problem because you are using .html for your server side includes (if I recall correctly).

Thanks guys, and sorry I got a little crabby yesterday, I've had stuff going on.
posted by IndigoRain at 8:13 PM on May 12, 2006

« Older Who in MontrĂ©al would take cellphones for charity?   |   Buying a Laptop for College Newer »
This thread is closed to new comments.