HTACCESS 密码保护适用于停放域,但不适用于主域
我有两个域名:asdf.com 和 asdf.ru(.ru 是停放域名)。它们指向服务器上的相同文件夹。 (一切都是一样的,唯一的区别是语言)。我无法使用子目录。 是否可以使用密码保护.ru域,但让.com域不受保护?
谢谢。
I have two domain: asdf.com and asdf.ru (.ru is a parked domain). They are pointing to the same folder on the server. (Everything is the same, the only difference is the language). I cannot use subdirectories.
Is it possible to protect the .ru domain with password, but leave unprotected the .com domain?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看这个答案,它根据主机名设置一些环境变量,然后您可以使用这些变量创建一些条件 IfDefine 块(您可以尝试在其中放置访问控制规则
) com/questions/736524/how-can-i-have-a-conditional-htaccess-block">问:我如何拥有条件 .htaccess 块?
编辑 实际上,它看起来您无法使用重写来设置环境变量,然后您可以使用 IfDefine 检查该环境变量。这两个例子似乎是分开的。这只有在您拥有自己的服务器时才有可能 - 在这种情况下,您可以将两个域放在单独的虚拟主机中。
Have a look at this answer which sets some environment variables based on the hostname, which you can then use to create some conditional IfDefine blocks (in which you can try putting your access control rules)
Q: How Can I Have A Conditional .htaccess Block?
EDIT actually, it looks like you can't use rewrites to set an environment variable which you can then check with IfDefine. The two examples seem to be separate. This may only be possible if you have your own server - in which case you would be able to put the two domains in separate vhosts.