-1

So let's say I have two domains: www.foo.com and www.bar.com. They are on seperated servers (for now, that could be changed) and we've built a new site for the bar content that you can access now by www.foo.com/bar

As far, as good, every thing is working. But now we want to display the bar content at www.bar.com. If we'd just make a C-Name we would still have to type www.bar.com/bar which is kind of strange.

What can we do to get the content of www.foo.com/bar ar www.bar.com (of course www.foo.com/bar/baz/123 should be available at www.bar.com/baz/123 and so on)

wawa
  • 4,816
  • 3
  • 29
  • 52

2 Answers2

1

If you don't want to redirect, then you will have to proxy on www.bar.com using [P] Flag. So on your www.bar.com server .htaccess you should be able to do something like this.

RewriteEngine On
RewriteRule ^(.*) http://www.foo.com/bar/$1 [P]

http://httpd.apache.org/docs/current/rewrite/flags.html#flag_p

Note: mod_proxy is required and needs to be enabled in Apache if not already.

Panama Jack
  • 24,158
  • 10
  • 63
  • 95
0

Try this in your htaccess

 RedirectMatch 301 ^/(.*)/?$ http://www.bar.com/$1

The above example redirects the entire site to domain b.

If you want to redirect /bar requests to domain B , then try the following

 RedirectMatch 301 ^/bar/(.*)/?$ http://www.bar.com/$1
Amit Verma
  • 40,709
  • 21
  • 93
  • 115