Using env variables with RewriteRule and ErrorDocument
- by misterte
Hi,
I'm having problems with the following while config. my Apache server to Rewrite some urls.
SetEnv PATH_TO_DIR /directory
RewriteRule ^%{PATH_TO_DIR}/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-\.]+)/?$ /index.php?dir=$1&file=$2
ErrorDocument 404 %{PATH_TO_DIR}/index.php?dir=null&file=error
This conf. used to work perfectly fine until I used SetEnv PATH... etc. I need to use this because there are lots of rules, not just those.
Can anyone point out my mistake?
Apache returns
%{PATH_TO_DIR}/index.php?dir=null&file=error
when I try anything (www.site.com/foo/bar for instance).
Apache returns the ErrorDocument if i just try to fetch the index.
I know it's not a problem with the rewrite rules because they work when I remove the PATH_TO_DIR variable and just hard code it.
Thanks!
A.