如何查看重写规则或服务器的RewriteCond变量的值? [英] How can I see the value of RewriteRule or RewriteCond server variables?

查看:167
本文介绍了如何查看重写规则或服务器的RewriteCond变量的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,如果我想看到的是一些什么样的变量值在PHP我这样做:

For example, if I want to see what value is in some variable in php I do this:

$foo = 'This is a variable foo';

var_dump($foo);  // string(22) "This is a variable foo"
echo $foo;       // This is a variable foo
print_r $foo;    // This is a variable foo

但是,当我写一些的mod_rewrite 规则,现在我只能猜测什么样的价值涉​​及到重写规则,什么改写后变成域($ 0 )

But when I write some mod_rewrite rules, for now I can only guess what value comes to the RewriteRule and what it becomes after rewriting ($0):

<Directory /public>
    DirectoryIndex index.php
</Directory>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]   // what is %{REQUEST_FILENAME}
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+)$ $0 [NC, L]             // what is ^(.+)$, and what is $0?

有没有什么办法可以打印或以某种方式看到我在每行之后还有什么价值得到什么呢?例如,我想看看会发生什么在重写规则^(。+)$ $ 0 NC,L] ,什么是 ^( +)$ ,什么是然后在 $ 1,0

Is there any way to print or somehow to see what value I get after each line? For example, I'd like to see what comes in RewriteRule ^(.+)$ $0 [NC, L], what is in ^(.+)$ and what is then in $0.

推荐答案

没有,没有,你问路。

No, there isn't the way you ask.

错误日志是一个很好的帮助。设置LogLevel的调试,像这样: LogLevel的调试的httpd.conf 文件

The error log is a good help. Set LogLevel to debug, like this: LogLevel debug in the httpd.conf file.

如果使用的是Firefox,你可以尝试 的LiveHTTPHeaders,例如,看标题和其他相关信息。有相当的扩展其他浏览器。

If using Firefox, you can try livehttpheaders, for example, to watch the headers and other relevant information. There are equivalent extensions for other browsers.

不用说,在映射地址的PHP脚本回声的var_dump($ _ SERVER); 或类似的声明,将显示结果的完整信息。

Needless to say, a php script at the mapped address with echo var_dump($_SERVER); or similar statement, will display a complete information of the result.

这篇关于如何查看重写规则或服务器的RewriteCond变量的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆