For some reason, the www/apache22 FreeBSD port does not support the mod_substitute module even though it’s bundled standard with Apache. The following patch enables building of this useful module, which compiles and works just fine out of the box.
UPDATE: After e-mailing the maintainer, this patch has been officially merged into the port as of March 29, 2011.
--- Makefile.modules.orig 2010-08-19 13:01:08.000000000 -0500 +++ Makefile.modules 2011-03-28 15:00:40.000000000 -0500 @@ -29,7 +29,7 @@ MISC_MODULES+= actions alias asis autoindex cern_meta \ cgi charset_lite dbd deflate dir dumpio env expires \ headers imagemap include info log_config logio mime \ - mime_magic negotiation rewrite setenvif speling status \ + mime_magic negotiation rewrite setenvif speling status substitute \ unique_id userdir usertrack vhost_alias filter version reqtimeout PROXY_MODULES= proxy proxy_connect proxy_ftp proxy_http proxy_ajp proxy_balancer proxy_scgi SSL_MODULES= ssl --- Makefile.options.orig 2010-08-19 13:01:08.000000000 -0500 +++ Makefile.options 2011-03-28 14:54:16.000000000 -0500 @@ -56,6 +56,7 @@ SETENVIF "Enable mod_setenvif" ON \ SPELING "Enable mod_speling" ON \ STATUS "Enable mod_status" ON \ + SUBSTITUTE "Enable mod_substitute" OFF \ UNIQUE_ID "Enable mod_unique_id" ON \ USERDIR "Enable mod_userdir" ON \ USERTRACK "Enable mod_usertrack" ON \ --- pkg-plist.orig 2010-08-19 13:01:10.000000000 -0500 +++ pkg-plist 2011-03-28 14:57:28.000000000 -0500 @@ -79,6 +79,7 @@ include/apache22/mod_rewrite.h include/apache22/mod_ssl.h include/apache22/mod_status.h +include/apache22/mod_substitute.h include/apache22/mpm.h include/apache22/mpm_common.h include/apache22/mpm_default.h @@ -164,6 +165,7 @@ %%MOD_SPELING%%libexec/apache22/mod_speling.so %%MOD_SSL%%libexec/apache22/mod_ssl.so %%MOD_STATUS%%libexec/apache22/mod_status.so +%%MOD_SUBSTITUTE%%libexec/apache22/mod_substitute.so %%MOD_SUEXEC%%libexec/apache22/mod_suexec.so %%MOD_UNIQUE_ID%%libexec/apache22/mod_unique_id.so %%MOD_USERDIR%%libexec/apache22/mod_userdir.so