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.

Is there anyway I can redirect from site1.com to site2.com without having url change in addressbar.

I have tried different solutions available here which are mostly for redirect rule/conditions within the same domain. There is no example available for redirects to a different domain.

Unfortunately I do not have access to httpd config due to shared hosting plan for which host wont do it for me.

share|improve this question

1 Answer 1

You either do this server side by proxying the traffic. By either a dedicated load balancer or by apache mod-rewrite or mod-proxy for example.

Here is an example with mod-proxy.

ProxyRequests Off
 <IfModule mod_proxy.c>
  ProxyPass / http://site2.com/
  ProxyPassReverse / http://site2.com/
</IfModule mod_proxy.c>

However if you don't have access to httpd config and only .htaccess I doubt your provider will let you run any kind of proxying.

An alternative is to use a simple html based hack with frames or iframe.

<frameset rows="100%">
 <frame src="http://site2.com">
</frameset>
share|improve this answer
    
One comment - you probably want ProxyPassReverse to be site1.com instead, otherwise the location bar will show the second site instead of the first one. –  Jenny D Mar 27 '13 at 8:04
    
Are you sure? I thought ProxyPassReverse was mostly to ensure references to site2 was replaced with site1 in the document returned to the client? –  flurdy Mar 27 '13 at 22:02
    
On checking, we're both wrong. You should keep site2 in ProxyPassReverse, but it doesn't change the contents of the document, it only changes any redirects sent, as per httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypassreverse –  Jenny D Mar 28 '13 at 7:39

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.