htaccess的重定向到外部URL而隐藏重定向 [英] .htaccess redirect to external URL while hiding redirect

查看:328
本文介绍了htaccess的重定向到外部URL而隐藏重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够重定向一个域名指向我的网站主办外部域。

I want to be able to redirect a domain pointed to my webhosting to an external domain.

例如,我有这个在我的.htaccess:

For example, I have this in my .htaccess:

RewriteCond %{HTTP:Host} ^(?:www\.)?mydomain\.example$ 
RewriteRule ^(.*)$ http://myexternal.example/site [R=301,NC]

然而,当我访问域名,在我的地址栏更改URL的 HTTP://myexternal.example/site 的。

我如何可以重定向不改变网址?

How can I redirect without changing the URL?

有没有解决这个另一种方式?我是否需要使用框架/ IFRAME?

Is there another way around this? Do I need to use a frame/iframe?

推荐答案

位很久以前,但我无论如何对于那些谁到这里来由谷歌(像我一样)回答这个问题。答案其实很简单:

Bit long ago, but I'll answer the question anyway for those who come here by Google (like me). The answer is really simple:

在你的htaccess,除去R = 301的一部分(当然还有逗号)。

In your htaccess, remove the R=301 part (and the comma of course).

R = 301意味着你通过301重定向做到这一点。你不希望出现这种情况。

R=301 means you do it via a 301 redirect. You don't want that

这篇关于htaccess的重定向到外部URL而隐藏重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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