Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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]

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

Is this even possible?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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]
share|improve this answer
thank you. this is exactly what I wanted! :) cheers.. –  Hamed Momeni Jul 27 '11 at 6:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.