Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有可能做到这一点
RewriteRule robots.txt dirname(%{DOCUMENT_ROOT})/robots.php [L]
我需要获取 DOCUMENT_ROOT 的父文件夹
您无法在文件的上下文中创建指向文档根目录之外的目标的重写规则.htaccess,因此即使可以找到父目录(我对此表示怀疑),它也不起作用。
.htaccess
我知道解决这个问题的唯一方法是创建一个指向正确robots.php文件的符号链接。甚至可以创建一个指向 的相对符号链接../robots.php,我不确定。
robots.php
../robots.php