簡體   English   中英

我可以在apache config中連接環境變量嗎?

[英]Can I concatenate environment variables in apache config?

我在apache config中有兩個環境變量,我想將它們連接成一個新的環境變量。 這可能嗎?

我意識到這是行不通的,但是它展示了我所追求的那種東西:

SetEnv one foo
SetEnv two bar
SetEnv three one+two

...然后“三”的值將為“ foobar”

使用帶有兩個通配符反向引用的mod_rewrite正則表達式來訪問環境變量並連接字符串:

#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]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM