[英]htaccess document_root dirname
is it possible to do this是否有可能做到这一点
RewriteRule robots.txt dirname(%{DOCUMENT_ROOT})/robots.php [L]
i need get parent folder of DOCUMENT_ROOT我需要获取 DOCUMENT_ROOT 的父文件夹
You can't create a rewrite rule pointing to a target outside the document root in the context of a .htaccess
file, so even if it were possible to find out the parent directory (which I doubt), it won't work.您无法在
.htaccess
文件的上下文中创建指向文档根目录之外的目标的重写规则,因此即使可以找到父目录(我怀疑),它也不起作用。
The only way around this that I know is creating a symbolic link that points to the correct robots.php
file.我知道的唯一解决方法是创建一个指向正确
robots.php
文件的符号链接。 It may even be possible to create a relative symbolic link pointing to ../robots.php
, I'm not sure.甚至可以创建一个指向
../robots.php
的相对符号链接,我不确定。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.