简体   繁体   English

在 htaccess 中显示结果

[英]Display results in htaccess

Is there any way to display htaccess directives results in real time?有没有办法实时显示 htaccess 指令结果? For example:例如:

RewriteCond %{DOCUMENT_ROOT}

Are there any instructions that can be placed inside htaccess to display %{DOCUMENT_ROOT} value?是否有任何指令可以放置在 htaccess 中以显示%{DOCUMENT_ROOT}值?

I know that can be accomplished with a PHP script in the right address, but I was wondering if it's also possible inside htaccess?我知道这可以通过正确地址中的 PHP 脚本来完成,但我想知道它是否也可以在 htaccess 中实现?

Try this尝试这个

RewriteEngine On
RewriteBase /
RewriteRule (.*) /$1?docroot=%{DOCUMENT_ROOT} [L,QSA]

Didn't have the possibility to test this but should work没有可能对此进行测试,但应该可以

From the Apache 2.2 documentation来自Apache 2.2 文档

In addition to plain text, the Substition string can include除了纯文本之外,Substition 字符串还可以包括

  • back-references ($N) to the RewriteRule pattern对 RewriteRule 模式的反向引用 ($N)
  • back-references (%N) to the last matched RewriteCond pattern向后引用 (%N) 到最后匹配的 RewriteCond 模式
  • server-variables as in rule condition test-strings (%{VARNAME})规则条件测试字符串中的服务器变量 (%{VARNAME})
  • mapping-function calls (${mapname:key|default})映射函数调用(${mapname:key|default})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM