I'm having problems with the following config on 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 config used to work perfectly until I used SetEnv PATH
etc. I need to use this because there are lots of rules, not just those mentioned above.
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.