重写URL无变化地址 [英] rewrite url without change address

查看:241
本文介绍了重写URL无变化地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示一个页面,而不是另外一个页面,没有变化的第二个页面的URL。 我知道这是可能的htaccess的。 我复制了code从CMS htaccess的:

I want to show a page instead of another page, without change the second page url. I know this is possible with htaccess. I copied that code from a cms htaccess:

RewriteRule ^event-([0-9]+)\.html$ calendar.php?action=event&eid=$1 [L,QSA]

与code,我们将重定向到 calendar.php?........ 。但我想它重定向(没有改变地址栏的地址)到另一个站点,例如的http://www.google.com/page ..... 。 可能吗? 谢谢..

with that code, we will redirect to calendar.php?......... but I want it redirect (without changing the address in address bar) to another site, for example to http://www.google.com/page...... Is it possible? Thanks ..

推荐答案

如果你想在不改变地址,在浏览器的地址栏是不是意味着你成为一个代理提供来自其他网站的内容

If you want to provide content from another site without changing the address in the address bar of the browser that mean you becomes a proxy.

因此​​,检查阿帕奇机制的文档的代理配置(这可以仅针对特定的URL来完成)。即使mod_rewrite的可以做代理的事情与[P]标记,mod_rewrite的将允许更多的具体网址过滤。

So check apache documention for proxy configuration (this can be done for specific urls only). Even mod_rewrite can do the proxy things with the [P] tag, mod_rewrite will allow a lot more 'specific url' filtering.

现在代理的工作时,他必须从遥远的网站的响应,他需要使其为HTTP客户端,是仅改变HTTP头中的响应。因此,在当前位置标记或如特定的头文件只能URL将被改变。你必须知道,从遥远的网站上所有的HTML内容不会改变(内部链接将在www.google.com上进行,而不是在你的www.whythehelldoiproxygooglewithmysite.com)。

Now the job of a proxy, when he have the response from the distant website and he needs to render it for the HTTP client, is only to change the HTTP headers in the response. So only url in Location tags or such specific headers will be altered. You must known that all the HTML content from the distant website will not be altered (the inner links will be on www.google.com and not on your www.whythehelldoiproxygooglewithmysite.com).

如果你想改变这种返回的内容检查mod_proxy_html模块,这将增加一些额外的东西送resonse之前,做一些反向代理的改变。

If you want to alter this returned content check mod_proxy_html module, this will add some extra stuff before sending the resonse, to do some more reverse proxy alterations.

这篇关于重写URL无变化地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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