我可以做一个的if / then / else语句htaccess的? [英] Can I do an if/then/else in htaccess?

查看:361
本文介绍了我可以做一个的if / then / else语句htaccess的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,提供了基于子域的特定内容。因此,它是一组相同的文件,也许头和基于子域名的网站的网页更改的一些信息。

I have a site that serves up certain content based on the subdomain. So it is the same set of files, and maybe the header and some info in the site pages changes based on the subdomain.

我需要根据子域也有不同的htpassword身份验证,但无法找到如何做一个信息的if / then事情在htaccess的类型。

I need to have different htpassword authentication based on the subdomain as well, but can't find info on how to do an if/then type of thing in htaccess .

基本上,我需要的是这样的:

Basically what I need is this:

如果子域='ABC' 使用此htpassword文件

if subdomain = 'abc' use this htpassword file

如果子域='高清' 使用此htpassword文件

if subdomain = 'def' use this htpassword file

可以这样做?

推荐答案

尝试是这样的:

SetEnvIf Host ^abc\. HOST_ABC
SetEnvIf Host ^dev\. HOST_DEF

<IfDefine HOST_ABC>
    AuthUserFile …
</IfDefine>
<IfDefine HOST_DEF>
    AuthUserFile …
</IfDefine>

这篇关于我可以做一个的if / then / else语句htaccess的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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