tags:

views:

47

answers:

2

I would like to use a path contained in a variable to include a file in an shtml/SSI page. Basically, I would like to set a variable with mod_rewrite first and then process the filename contained in the var.

<!--#include virtual="some_variable"-->

Is this possible without using another scripting language?

A: 

Use the E flag to set an environment variable in a rule, for example:

RewriteRule ^ - [E=some_variable:foobar]

Then you can access that via:

<!--#include virtual="some_variable" -->
Gumbo
A: 

I did some further tests, so I think I can answer my own question:

In addition to the rewrite rule mentioned above, it is necessary to access variables with a $-sign, e.g.

<!--#include virtual="$some_variable" -->

Alex Lehmann