【发布时间】:2019-05-11 06:55:56
【问题描述】:
我知道我可以在httpd.conf 中设置一个自定义变量,以便在.htaccess 中访问。我想让我的代码万无一失,这样当新程序员在新机器上设置它时,它就不会轻易出错。
如何从.htaccess 内部检查未定义的变量,以便在有人忘记在httpd.conf 中设置变量时仍然可以运行它?
RewriteBase /
RewriteCond ${ServerBase} !^$
RewriteBase ${ServerBase}
我以为!^$ 可以检测到未定义的变量,但是没有。
【问题讨论】:
标签: apache .htaccess mod-rewrite environment-variables httpd.conf