Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 7th, 2002, 02:17 PM
Jason O Jason O is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 6 Jason O User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Need help with Server Side Includes

I'm moving all of my files from web server to another, so I know the includes worked before.

However, the Apache installation on the new server was pretty much blank, so I followed the directions on the Apache web-site for activating SSI. I have the following in my httpd.conf file

Options ExecCGI +Includes
AddType text/html .shtml
AddHandler server-parsed .shtml

The HTML code looks like this

<!--#include virtual="/top.htm"-->

top.htm resides in the same directory as the calling page.

Whenever I try to load an .shtml file, it ignores the includes, so I am loosing my header and footer.

I am using Apache 1.3, I am not sure what the problem is.

Last edited by Jason O : February 7th, 2002 at 02:50 PM.

Reply With Quote
  #2  
Old February 7th, 2002, 07:48 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Where did you put that Options line? Within <Directory "/xxx/yyy">? What's the path of /xxx/yyy? Where is your .shtml file? What is the server path to your docroot?

Reply With Quote
  #3  
Old February 7th, 2002, 10:33 PM
Jason O Jason O is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 6 Jason O User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I don't have it within a <Directory> tag. That's pretty much my httpd.conf file as far as what applies to SSI.

The example .shtml file is in the root directory.

The document root path is /home/myname/httpd

Reply With Quote
  #4  
Old February 7th, 2002, 11:16 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> I don't have it within a <Directory> tag

Then you need to. For example:

<Directory "/home/myname/httpd">
Options ExecCGI +Includes
AllowOverride None
</Directory>

And these lines can be defined globally:

AddType text/html .shtml
AddHandler server-parsed .shtml

>> top.htm resides in the same directory as the calling page

Then <!--#include virtual="/top.htm"--> doesn't always work if your foobar.shtml and top.html reside at /home/myname/httpd/include directory.
When you are using include virtual the leading slash of /top.html is to tell Apache it's the root URI of the URL relative to your docroot as /home/myname/httpd/top.html.

Reply With Quote
  #5  
Old February 12th, 2002, 09:31 AM
Jason O Jason O is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 6 Jason O User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the help.

I actually figured it out before you posted the solution. Your earlier queries tipped me off that I did need the directory tags to make it work. The Apache documentation wasn't very clear about that.

Here's an odd note though. I could have sworn I read someone saying that using ../filename.htm would not work in includes, yet I'm doing that all over the place. Is it not supposed to work, or is it just a bad practice?

Reply With Quote
  #6  
Old February 12th, 2002, 04:32 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> that I did need the directory tags to make it work

Because Options ExecCGI is not enabled by default.

>> The Apache documentation wasn't very clear about that

The whatever Options and AllowOverride are interited from its parent directory. And subdir wins if the Options in that parent directory is overridden.

>> that using ../filename.htm would not work

Unlike PHP will less security concerns, in SSI, you just can't use ../../ as the paths because it was a secure design to enforce users not to do that bad practice - using ../../ is a bad practice in all programming language in the first place.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Need help with Server Side Includes


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway