Context:
I am using Server Side Includes to collate a number of .shtml pages together to form a single page. These files include headers, footers, etc. General #include statements I am using -where I explicitly name the included file- work fine, such as <!--#include virtual="/framework/parts/head.shtml" -->.
I am using the following line in an .htaccess file:
RewriteRule ^(.*)$ /framework/parts/shell.shtml?url=$1 [QSA,L]
This makes it to that when I load a page the shell.shtml file loads instead. This works as expected.
My goal is to have a single shell.shtml file that is called and used as the framework for every single .html file/page on the site, which then uses SSI #includes to populate the contents of the page that loads.
Existing Code:
If I strip down shell.shtml to the following, it demos the issue I am having. This code lives in the <body> of the file:
URI: <!--#echo var="DOCUMENT_URI" --><br>
Doc: <!--#echo var="DOCUMENT_NAME" --><br><br>
Echo the value of the variable <b>DOCUMENT_URI</b>, which is this page's URL: <i><!--#echo var="DOCUMENT_URI" --></i>. <br><br>
<!--#include virtual="DOCUMENT_URI" -->
Current Result:
This creates a page with the following:
URI: /private/index.html
Doc: shell.shtml
Echo the value of the variable DOCUMENT_URI, which is this page's URL: /private/index.html.
[an error occurred while processing this directive]
Question:
What do I need to do to pass the value of the system variable DOCUMENT_URI into the #Include, such that the contents of the file /private/index.html are included?
Additionally, I have found that even if I manually write out the final #include, not relying on any variables at all that it still throws that same error, so I believe this is somehow tied to the htaccess rewrites in some manner.
Add a
$to the reference. From:to: