我可以连接在Apache的配置环境变量?

编程入门 行业动态 更新时间:2024-10-18 05:52:15
本文介绍了我可以连接在Apache的配置环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在apache配置两个环境变量,我想将它们串联成一个新的环境变量。这可能吗?

I have two environment variables in apache config, I want to concatenate them into one new environment variable. Is this possible?

我知道这是不行的,但它表明了诸如此类的事情后,我:

I realise this doesn't work, but it demonstrates the sort of thing I'm after:

SetEnv one foo SetEnv two bar SetEnv three one+two

...然后'三'将具有值foobar的

...and then 'three' would have the value "foobar"

推荐答案

使用的 mod_rewrite的定期EX pression有两个通配符反向引用来访问环境变量和连接字符串:

Use a mod_rewrite regular expression with two wildcard backreferences to access the environment variables and concatenate the strings:

#This will be true for any user agent RewriteCond %{HTTP_USER_AGENT} ^.* #Replace / with / and set the new environment variable RewriteRule /(%{ENV:one})*(%{ENV:two})* / [E=three:$1$2]

更多推荐

我可以连接在Apache的配置环境变量?

本文发布于:2023-11-01 01:47:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547892.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:环境变量   Apache

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!