使用的.htaccess 301重定向没有在地址栏改变URL [英] Using .htaccess Redirect 301 without changing URL in Address Bar

查看:152
本文介绍了使用的.htaccess 301重定向没有在地址栏改变URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在有一个词preSS多站点网络设置。主站位于 然后,还有另外一个子域名HTTPhttp://safesideinc.com。:// danielgosek。 safesideinc.com。

I currently have a WordPress Multi-Site Network set up. The main website is located at "http://safesideinc.com." Then, there is another sub-domain "http://danielgosek.safesideinc.com."

我要的网址http://safesideinc.com导致http://safesideinc.com,和网址http://danielgosek.com导致http://danielgosek.safesideinc.com。

I want the URL "http://safesideinc.com" to lead to "http://safesideinc.com," and the URL "http://danielgosek.com" to lead to "http://danielgosek.safesideinc.com."

在.htaccess使用301重定向,我能做到这一点。不过,我想它,以便进入http://danielgosek.com在地址栏导致的http:// danielgosek。 safesideinc.com不改变显示的URL - 在这种情况下,显示的网址应保持。http://danielgosek.com

Using a 301 Redirect in .htaccess, I can achieve this. However, I would like it so that entering "http://danielgosek.com" in the URL bar leads to "http://danielgosek.safesideinc.com." WITHOUT CHANGING the URL displayed--in this case, the displayed URL should remain "http://danielgosek.com."

有没有什么规则,可以帮助我做到这一点?

Are there any rules that could help me achieve this?

推荐答案

不可能的,一个 301 - 永久重定向,是一个指令到浏览器的资源已经被永久移动和浏览器应该重新 - 直接到所提供的新的URL。

Not possible, a 301 - Permanent Redirect, is an instruction to the BROWSER that the resource has moved permanently and the BROWSER should re-direct to the provided new URL.

如果您不希望的URL来改变你要么需要两个虚拟主机/域之间的反向代理服务器设置,或者,如果 danielgosek.com 只是一个别名,相同的IP和从同一个Apache虚拟主机服务,您可以使用一个内部重写。

If you don't want the URL to change you either need a Reverse proxy set-up between the two virtual hosts / domains, or if danielgosek.com is just an alias, same IP and served from the same Apache virtual host, you could use an internal rewrite.

这篇关于使用的.htaccess 301重定向没有在地址栏改变URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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