Relative path variables in .htaccess

.htaccessapache-2.2

If I have an .htaccess file in a given directory within my website, and want to specify an ErrorDocument relative to the .htaccess file, NOT relative to the document root, is this possible?

Something like:
ErrorDocument 404 $CURRENT_DIRECTORY/404.php

Best Answer

While a number of directives are sensitive to relative directory while within an .htaccess or <Directory> context, ErrorDocument is not. Per the documentation:

URLs can begin with a slash (/) for local web-paths (relative to the DocumentRoot), or be a full URL which the client can resolve.

Related Topic