偷偷做的mod_rewrite的域名 [英] Secretly do a mod_rewrite on domain name

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

问题描述

我挣扎了mod_rewrite的问题。基本上,我需要做一个秘密重定向的域名,从去

I'm struggling with a mod_rewrite problem. Basically I need to do a secret redirect on the domain name, going from

http://domainname.com.someotherstuff.com

http://domainname.com

这个规则应该影响到所有子目录以及。

This rule should affect all subdirectories as well.

我理解有三个步骤:

  1. 告诉系统,如果路径相匹配,我们所要寻找的
  2. 定义重写规则
  3. 通过新路径,旧,使得系统知道(即使它不显示),这两个匹配

我抬头一看几个职位和资源(最接近的莫过于<一href="http://stackoverflow.com/questions/7053401/url-rewriting-invisibly-how-to-$p$pvent-rewritten-url-to-appear-in-the-address">this和<一href="http://stackoverflow.com/questions/18661786/how-to-hide-the-url-change-when-using-apache-rewrite">this)但没有人能解决我的两个问题 - 重写和秘密 - 在一次

I've looked up several posts and resources (the closest ones being this and this) but none of them can solve both my problems – rewriting and secrecy – at once.

任何人都可以点我在正确的方向?

Can anybody point me in the right direction?

此外,有人可以解释一个隐藏的重定向和301之间的权衡?隐藏重定向是不是搜索引擎友好的,对吗?

Moreover, can someone explain the tradeoff between a hidden redirect and a 301? Hidden redirect is not search engine friendly, correct?

非常感谢!

推荐答案

指的是澄清一个较旧的职位上<一个href="http://stackoverflow.com/questions/30602324/how-to-detect-an-incoming-request-with-php-script-from-a-cname-subdomain/30630937#30630937">rewrite VS重定向

referring to an older post for clarification on rewrite vs redirect

如果你想在客户的浏览器说 http://domainname.com ,而是从获取的 http://domainname.com.someotherstuff.com ,那么你想要的是一个重写。您将在 http://domainname.com 和指向你的客户回答前端(服务器/ LB /等...)然后将改写domainname.com到domainname.com.someotherstuff.com并发送请求到后端服务,将回答这个请求。我在此情况下preFER到SNAT,所以后端直接响应前端,然后返回该内容到客户毫无收获

If you want the customer's browser to say http://domainname.com, but fetch the content from http://domainname.com.someotherstuff.com, then what you want is a rewrite. You will point your customer at http://domainname.com and that answering frontend (server/LB/etc...) will then rewrite "domainname.com" to "domainname.com.someotherstuff.com" and send the request on to a backend service that will answer that request. I prefer to SNAT in this case, so the backend responds directly to the frontend, which then returns the content to the customer none the wiser.

您有几个运动部件的位置:

You have several moving parts here:

    为domainname.com和domainname.com.someotherstuff.com
  1. DNS条目
  2. 在前端 - F5s是我的最爱,但你可以实现与任何Linux服务器类似的结果;需要能够解决domainname.com.someotherstuff.com并且具有网络连接到后端;对于 http://domainname.com 服务请求
  3. 在后台 - 网络服务器;对于 http://domainname.com.someotherstuff.com 服务从前端请求
  1. DNS entries for domainname.com and domainname.com.someotherstuff.com
  2. frontend - F5s are my favorites, but you can achieve similar results with any linux server; needs to be able to resolve domainname.com.someotherstuff.com and has network connectivity to the backend; servicing requests for http://domainname.com
  3. backend - web server; servicing requests from frontend for http://domainname.com.someotherstuff.com

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

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