HTACCESS 密码保护适用于停放域,但不适用于主域

发布于 2024-09-14 11:31:04 字数 214 浏览 0 评论 0原文

我有两个域名: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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

国粹 2024-09-21 11:31:04

看看这个答案,它根据主机名设置一些环境变量,然后您可以使用这些变量创建一些条件 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文