隐形域名转发 [英] Stealth Domain forwarding

查看:111
本文介绍了隐形域名转发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是隐身着这个first.domain.com到second.domain.com最简单的方法是什么?已经与C $ CS这个$在.htaccess尝试它:

what is the easiest way to stealth forward this first.domain.com to second.domain.com? Been trying it with this codes in .htaccess:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^first.domain.com$
RewriteRule (.*)$ http://second.domain.com [R=301,L]

rewriteengine on
rewritecond %{REQUEST_URI} first.domain.com/
rewriterule (.*) http://second.domain.com [l,nc]

但我有没有运气可言。我想保留first.domain.com在我的地址栏,即使页面已经在second.domain.com。先谢谢了。

But I'm having no luck at all. I want to retain "first.domain.com" on my address bar even when the page is already on second.domain.com. Thanks in advance.

推荐答案

您想在第一,但值得注意的是你需要替换 R = 301 P (用于代理),并可以添加一个反向引用的规则匹配:

You want the first, but notably you need to replace R=301 with P (for proxy), and you can add a backreference for the rule match:

RewriteRule ^(.*)$ http://second.domain.com/$1 [P,L]

这样, http://first.domain.com/some/file.html将获得代理到 http://second.domain.com/some/file.html和地址栏还是会说: http://first.domain.com/some/file html的

This way, http://first.domain.com/some/file.html will get proxied to http://second.domain.com/some/file.html and the address bar will still say: http://first.domain.com/some/file.html

这篇关于隐形域名转发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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