...

View Full Version : .htaccess and SSI



brduran
06-15-2003, 05:19 AM
I have the following ".htaccess" to instruct the server to look in all ".htm", ".html" and ".shtml" for Server Side Include:


AddType text/html .shtml
AddHandler server-parsed .htm
AddHandler server-parsed .html
AddHandler server-parsed .shtml
Options Indexes FollowSymLinks Includes
DirectoryIndex index.htm index.html index.shtml index.asp index.php
Options -Indexes
It only works with the main page "index.htm" when uploaded to the main site directory. The rest of the pages --in any of the subdirectories below the main one-- return this error message "[an error occurred while processing this directive] "

See it working here, the text on the upper right corner:
http://www.teknician.com/index.htm

See the error message here, on the upper right corner:
http://www.teknician.com/services/main.htm

What can I do to fix it? Any ideas please?

bluephoenix
06-17-2003, 03:24 AM
There's nothing wrong with your .htaccess file. In fact, the [an error occured...] message is an indication that mod_include is scanning for and processing SSI+ directives in those directories.

Rather, since you're having problems in different directories you should double check your include directives to and make sure that they point to the correct location for the included file.

Good luck, let me know how it turns out.

-Tim

brduran
06-19-2003, 09:58 PM
Hi bluephoenix,

The links are good, they point to the right location where the SSIed file is.

See, SSI changes posted to the main and ssi directories work fine, whether I add a copy of ".htaccess" to every subfolder or not. But on the rest of the folders the opposite happens, again whether I use one main ".htaccess" or I add one to every subfolder.

If you click on the links below you'll see the inconsistency I'm talking about. What we have here is the exact same file saved to different directories -- links already checked. I also uploaded a copy of ".htaccess" to each directory, just in case.

No error
http://www.teknician.com/ssi_temp.htm
http://www.teknician.com/ssi/ssi_temp.htm

Error
http://www.teknician.com/services/ssi_temp.htm
http://www.teknician.com/special/ssi_temp.htm
...and so on

Any ideas welcome! Thank you.

boggly
06-21-2003, 10:57 AM
For your include directive are you using file or virtual?

brduran
06-22-2003, 04:29 AM
Hi boggly,

I'm using 'file'. I've tried 'virtual', same results. I sent an email to the webmaster and one of his ideas was to upload a copy of '.htaccess' to every folder -- didn't work. Then he added a directive that allow my '.htaccess' to override the default settings of the server -- did not work either. I kind of gave up, you could only have an error message showing on your website for so long. But mind you, if you're like me you like to get to the bottom of every problem.

If you have any more suggestions, drop'em here. Thank you!

boggly
06-23-2003, 04:50 AM
Not to be overly simplistic, but are you 100% sure your path is correct? Sometimes you have to either put in a slash at the beginning of the path or remove one from it, othewise things won't work.

Feyd
07-11-2003, 12:00 AM
If you are using virtual, you need to have your include start with a / and be from the top directory down. So if I was trying to include a file which was in my includes folder (mysite.com/includes/) I would use
<!#--include virtual="/includes/filename.ext" -->

Also, you are telling a lot of pages to look for server-parsed commands...that is going to add overhead to your loading and processing times, so if your host is a bit slow, you are going to (perhaps) see a little delay in loading times...depending on what those includes are doing.

You should try and avoid using so many different pages with so many different extensions, try to keep them common for both your sake and your maintenance's sake.

bluephoenix
07-11-2003, 12:12 AM
Why not try an absolute uri, as in:

<!--#include file="http://www.mydomain.com/directory/included_file.html" -->

-Tim

Feyd
07-11-2003, 12:21 AM
It is almost never (basically never) suggested to use a FQDN in any linking system that links to your own site's interior. What if you run multiple domain names? What if you change the directory locations? What if you multiple domain names pointing to the same directory? What if you change your domain? What if you don't have www enabled in your FQDN? What if you run virtual domains? subdomains? etc. etc.

You can also run into firewall issues when accessing through a DMZ setup while linking to full domain names back into your interior...

As far as maintaing your site, especially as it gets larger and more complex, as you start refining and reordering your site to work better...virtual paths always work best...for images, for documents, for includes, for css, for js, etc. etc.

bluephoenix
07-12-2003, 01:23 AM
I still think he still should try an absolute path to make sure it's the configuration that's not working instead of a malformed url.

As another thought, has the administrator hacked mod_include to disable the include statement? As far as I know an Apache configuration file can disable the execution of CGI but include directives can cause security breaches too. Perhaps mod_include was modified before compilation (that's the joy of Open Source)leaving SSI's abilities little more than echoing dates. and filemod timestamps.

As for the myriad whatif FQDN arguments, read w3.org/Provider/Style/URI.html (http://www.w3.org/Provider/Style/URI.html).

-Tim



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum