在通配符的情况下创建子域名一个Apache SETENV变量 [英] Create an Apache SetEnv variable with the subdomain name in case of wildcard
问题描述
我有一个基本建立,因为这一个网站:
client_name.website.com
I have a website that is basically set up as this: client_name.website.com
...其中CLIENTNAME实际上是一个通配符。对于每一个新客户,我基本上是创建一个子域。
...where clientname is actually a wildcard. For every new customer, I create a subdomain basically.
我需要直接自动获得Apache提供的客户端名称信息。例如,如果一个来自throught:
client1.website.com
......我想有阿帕奇做
SETENV CLIENT_NAME客户端1
对我来说。
I need to automatically get the client name info directly from Apache. For example, if one comes throught: client1.website.com ...I would like to have apache do a SetEnv CLIENT_NAME client1 for me.
由于我带通配符的工作,这将是很好,如果这SETENV将动态完成的。真正对之实践数额巨大的客户。
Since I work with wildcard, it would be nice if this SetEnv would be done dynamically. Really pratical for great amounts of customers.
你将如何实现这一目标?
先谢谢了。
How would you achieve this ? Thanks in advance.
推荐答案
试试这个:
SetEnvIf Host "^([^\.]*)\.website\.com$" CLIENT_NAME=$1
希望帮助。
这篇关于在通配符的情况下创建子域名一个Apache SETENV变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!