隐形域名转发域名

由网友(散就散八沒卅子*)分享简介:什么是隐身着这个first.domain.com到second.domain.com最简单的方法是什么?已经与C $ CS这个$在.htaccess尝试它:what is the easiest way to stealth forward this first.domain.com to second.domain...

什么是隐身着这个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

阅读全文

相关推荐

最新文章