是否有可能输出.htaccess文件任何或所有可用的变量? [英] Is it possible to output any or all available variables in a .htaccess file?

查看:174
本文介绍了是否有可能输出.htaccess文件任何或所有可用的变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图构建一个.htaccess文件与一些重写规则,并想知道几个变量实际上包含了我的请求被处理时。是看到他们的价值会在阿帕奇处理请求的存在呢?

I'm trying to a build a .htaccess file with some rewrite rules and would like to know what several variables actually contain when my request is handled. Is there anyway of seeing what their values would be when Apache handles the request?

例如。打印%的内容{HTTP_USER_AGENT}

推荐答案

当然。建立这种PHP文件中(echo.php):

Sure. Create this sort of .php file (echo.php):

<?php
phpinfo(INFO_VARIABLES);
?>

添加此规则在.htaccess:

Add this rule in .htaccess:

RewriteEngine On

RewriteCond %{REQUEST_URI} !echo.php
RewriteRule .* echo.php?ua=%{HTTP_USER_AGENT}&https=%{HTTPS} [L]

如果需要添加更多的参数。

Add more parameters if necessary.

现在拨打任何URL,并检查输出(GET参数应该是表的顶部)。

Now call any URL and check the output (the GET parameters should be on the top of table).

不过,TBH,几乎所有的这些信息接收Apache和可到PHP反正:看 $ _ SERVER

But, TBH, almost all of this info is received by Apache and is available to PHP anyway: look at $_SERVER.

这篇关于是否有可能输出.htaccess文件任何或所有可用的变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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