htaccess 用于单个虚拟主机上的多个域

发布于 2024-10-06 14:58:17 字数 312 浏览 0 评论 0原文

如果我有一个网站,其域名为someone.com,它是主网站,还有另外两个域名mything.com 和yourthing.com。所有域都指向服务器上的相同 IP 和相同路径。

当我访问someone.com时,index.php已加载,但是当我访问mything.com和yourthing.com时,我希望index.php加载如下参数: index.php?site=mything.com 在代码中,我将识别它是哪个域并加载相关数据。

在客户端的地址栏中,我希望保留输入的域名。

我怎样才能用 htaccess 实现这一点?

干杯...

If I have a website with the domain someone.com which is the main site and two other domains mything.com and yourthing.com. All domains point to the same IP and the same path on the server.

When i go to someone.com, index.php is loaded and but when I visit mything.com and yourthing.com i want index.php loaded with a parameter like:
index.php?site=mything.com
In the code i'll identify which domain it is and load the relevant data.

In the address bar at the client I want the entered domain name to remain.

How can I achieve this with htaccess?

Cheers...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

自由如风 2024-10-13 14:58:17

找到了一个解决方案,使用 $_SERVER 变量和一些漂亮的 apache 设置。

Found a solution, using the $_SERVER vars and some nifty apache setup.

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