rewrite url without change address
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$ cale开发者_运维知识库ndar.php?action=event&eid=$1 [L,QSA]
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.
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.
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).
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.
精彩评论