Take the 2-minute tour ×
Server Fault is a question and answer site for professional 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]
</IFModule>

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
add comment

1 Answer

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

Your Answer

 
discard

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.