|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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?
|
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
>> 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. |
|
#5
|
|||
|
|||
|
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? |
|
#6
|
|||
|
|||
|
>> 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. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > Need help with Server Side Includes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|