.htaccess 屏蔽域

发布于 2025-01-06 17:51:50 字数 812 浏览 3 评论 0 原文

我有一个服务器。我们称之为 http://A.com 我还有一个“Enjin”论坛板。我们称之为 http://ABcom

该服务器对于管理员的许多脚本和功能组件都很有用。论坛板是供社区使用的,但我只能向其中添加 HTML 模块。没有自定义脚本。

目前,我已将其设置为将 http://A.com 的索引重定向到 http://ABcom 使用 HTML 重定向,因此导航到 A.com 根目录的用户将被发送到论坛。

我想这样做,如果您导航到 http://A.com,它将显示 http://ABcom。我们曾经使用过 iFrame,但这对论坛产生了不利影响,所以目前我们只是重定向它们。我看到有人使用相同的系统,其 URL 例如 http://C.com/forums/viewforum /212877 显示 http://CBcom/forums/viewforum/212877

我认为 mod_rewrite 可以做到这一点,但具体如何呢?

I have a server. Lets call it http://A.com
I also have an 'Enjin' forum board. Lets call it http://A.B.com.

The server is useful for many scripts and functional components for the admins. The forum boards are for the community, but I can only add HTML modules to it. No custom scripting.

Currently, I have it set up to redirect the index of http://A.com to http://A.B.com using HTML redirection, and so those who navigate to the root of A.com will be sent to the forums.

I would like to make it so if you navigate to http://A.com, it'll show the contents of http://A.B.com. We once used an iFrame, but that had a detrimental affect on the forums, so currently we just redirect them. I've seen someone using the same system have a URL such as http://C.com/forums/viewforum/212877 showing the contents of http://C.B.com/forums/viewforum/212877

I assume mod_rewrite could be capable of this, but how exactly?

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

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

发布评论

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

评论(1

眼睛会笑 2025-01-13 17:51:50

听起来您想设置一个反向代理,其中客户端从 http://A.com/ 使用 HTTP 从 http://ABcom/ 检索页面,然后将该内容作为其自己的响应返回给客户端。

请参阅http://httpd.apache.org/docs/2.2/mod/ mod_proxy.html#proxyvia

"使用 ProxyPass 指令或 RewriteRule 指令。没有必要转动 ProxyRequests 以便配置反向代理。”

您需要检查页面上的链接会发生什么情况。如果 http://ABcom/ 使用绝对链接,那么它们将指向 http://ABcom/ 。但相对链接仍位于 http://A.com/ 下。

It sounds like you want to set up a reverse proxy wherein a client requests a page from http://A.com/ retrieves the page from http://A.B.com/ using HTTP, and then returns that content as it own response to the client.

See http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxyvia

"A reverse proxy is activated using the ProxyPass directive or the [P] flag to the RewriteRule directive. It is not necessary to turn ProxyRequests on in order to configure a reverse proxy."

You would need to check what happens regarding links on pages. If http://A.B.com/ uses absolute links then they will be to pages inside http://A.B.com/ . But relative links will still be under http://A.com/ .

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