3

I have a domain, mydomain.com, which I would like to display content from another site. For example, imagine that there is content at this url --> http://www.foo.com/my/file.bar, and I would like the content from that page to be displayed when a user visits http://www.mydomain.com/my/file.bar, without the user seeing the URL from foo.com.

I currently use the following apache directive in my .htaccess:

<IFModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(.*)$ http://www.foo.com/$1 [L]
</IFModule>

However, this redirects the user's browser to the URL in foo.com, which I do not want.

Is this even possible?

womble
  • 96,255
  • 29
  • 175
  • 230
2hamed
  • 479
  • 1
  • 5
  • 23

1 Answers1

3

You can combine mod_rewrite with mod_proxy to do transparent redirect (reverse proxy) with mod_rewrite by add P flag to RewriteRule

  <IFModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule ^(.*)$ http://www.foo.com/$1 [P,L]
   </IFModule>
Kristaps
  • 2,985
  • 17
  • 22