开发者

htaccess document_root dirname

开发者 https://www.devze.com 2023-03-02 09:35 出处:网络
is it possible to do this RewriteRule robots.txt dirname(%{DOCUMENT_ROOT})/robots.php [L] i need get parent folder of D开发者_Go百科OCUMENT_ROOTYou can\'t create a rewrite rule pointing to a target

is it possible to do this

RewriteRule robots.txt dirname(%{DOCUMENT_ROOT})/robots.php [L]

i need get parent folder of D开发者_Go百科OCUMENT_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.

The only way around this that I know is creating a symbolic link that points to the correct robots.php file. It may even be possible to create a relative symbolic link pointing to ../robots.php, I'm not sure.

0

精彩评论

暂无评论...
验证码 换一张
取 消