I have a domain http://www.example.com which has a hosting package and website on it.

I also have a http://example.no-ip.org domain which contains some content I would like to appear under the same domain.

Can I setup a .htaccess file at http://www.example.com/proxy/ which proxies the files at http://www.example.no-ip.org/files/

Similarly, could I host an entire domain in the same way?, e.g. http://www.example2.com/ proxying http://example.no-ip.org/files2/

Alternatively, if someone were to say "That's stupid, use this free (or super-cheap) dynamic DNS host:" I would probably accept that answer.

  • Is there a reason why you can't simply put all the content on one host and eliminate the problem completely? Mar 29 '10 at 23:38
  • That host doesn't allow ssh access, and I like to update via git. Mar 30 '10 at 0:02

Basically, you'd need to setup a Reverse Proxy. In Apache, this is done using ProxyPass and ProxyPassReverse, but these directives can't be used in .htaccess.

There is a proxy option in mod_rewrite, so if mod_rewrite and mod_proxy is enabled, you could maybe use something like

RewriteRule ^/(.*)$  http://example.no-ip.org/files2/$1 [P]

in your .htaccess, this would proxy example2.com/x.html to example.no-ip.org/files2/x.html. Redirects etc. sent from the backend will not work since you can't specify ProxyPassReverse. All in all not the way to go, so either putting everything in the same server or registering a DNS entry are both way better options.

  • DNS is out because getting a Static IP on my ISP is magnitudes costlier than getting a cheap hosting package... Thanks for the response though I'll try it out. Mar 30 '10 at 0:05
  • Or, if you really have to do it as you described, but you can't configure Apache to do it, you could use a "handmade" proxy in PHP or CGI. Mar 30 '10 at 0:05

Nope But you can use apache's mod proxy to do something similar:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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