在使用Apache配置的查询字符串设定网址标头 [英] set referrer header using query string on apache configuration

查看:216
本文介绍了在使用Apache配置的查询字符串设定网址标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从查询字符串参数,并将其设置在网址标头到Apache配置文件。
你知道这可能吗?

i need to take a parameter from query string and set it in referrer header into Apache configuration file. Do you know if is it possible?

我能够从饼干做同样的,但我需要用做查询字符串

i'm able to do the same from cookie but i need to do using query string

setEnvIfNoCase ^Cookie$ "(referrer=\w*:\/\/\w*)" HTTP_MY_COOKIE=$1
setEnvIfNoCase HTTP_MY_COOKIE "(http:\/\/.*\.\w*)" REFERRER=$1
RequestHeader set Referer %{REFERRER}e

关于

推荐答案

解决方案是非常简单的。
setEnvIfNoCase或SetEnvIf之后不能使用查询字符串所以不能用我用饼干同样的伎俩,该解决方案的RewriteCond与重写规则组合就像下面的例子:

The solution was quite simple. setEnvIfNoCase or setEnvIf can't use the query string so is not possible to use the same trick i used for the cookies, the solution is a combination of RewriteCond with RewriteRule like in the example below:

RewriteCond %{QUERY_STRING} referrer=(.*)
RewriteRule ^/ - [env=REFERRER:%1]
RequestHeader set Referer %{REFERRER}e

我回答我的问题,让其他用户(如果存在)同样的问题可以找到一个出发点。

i answered to my question so another user (if exist) with the same question can find an starting point.

这篇关于在使用Apache配置的查询字符串设定网址标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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