4

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.

Dean Rather
  • 1,090
  • 1
  • 13
  • 18

2 Answers2

2

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.

C. Ramseyer
  • 281
  • 1
  • 3
  • 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. – Dean Rather Mar 30 '10 at 00: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. – C. Ramseyer Mar 30 '10 at 00:05
1

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

http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#proxypass

atomicharri
  • 321
  • 6
  • 24