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 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.

share|improve this question
    
Is there a reason why you can't simply put all the content on one host and eliminate the problem completely? –  John Gardeniers Mar 29 '10 at 23:38
    
That host doesn't allow ssh access, and I like to update via git. –  Dean Rather Mar 30 '10 at 0:02
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
    
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 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. –  C. Ramseyer Mar 30 '10 at 0:05
add comment

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

share|improve this answer
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.