views:

47

answers:

1

I have a directory structure on our VPS like this:

/www
  /site_one
  /site_two

And going to www.siteone.com brings you to /www/site_one/ on the server. I'd like to use mod_rewrite to point a request for www.siteone.com/thing/ to the directory /www/site_two/thing.

I've tried a basic rewrite like:

RewriteRule ^page.html$ /www/site_two/new_page.html

but / refers to /www/site_one/

Is there a way to get it to serve the page from the directory I'd like?

EDIT

To answer the questions below:

@Ignacio I'm not sure if I left anything important out. Brand new to mod_rewrite.

@outis: Yes both sites are virutal hosts. www.site_one.com is mapped to /www/site_one/ and www.site_two.com is mapped ot /www/site_two

+1  A: 

Give a full URL, which implicitly redirects:

RewriteCond %{HTTP_HOST} (.*\.)site_one\.com$
RewriteRule ^/?(thing(/.*)?) http://%1site_two.com/$1

To achieve this without redirection, the documents in /www/site_two must be accessible via URLs in the site_one.com domain; a symlink from /www/site_one/site_two to /www/site_two might do it.

outis
That's slick. I would not have thought of adding a symlink to get the desired effect. I'd give ya another +1 if I could!
Erik
Don't forget to allow following of symlinks should you decide to go that route.
Ignacio Vazquez-Abrams
outis