views:

60

answers:

2

I'm trying to point a subfolder from one domain to another on my vhost (mediatemple). I want to use internal rewrites, not 301 redirects. Here's the goal

http://www.clientdomain.com/blog/$1 --> http://www.mydomain.com/wpmu/clientdomain/$1

On the server side, the structure looks like this:

/x/y/z/domains/clientdomain.com/html/blog/ -- htaccess file is here
/x/y/z/domains/mydomain.com/html/wpmu/ -- wpmu installation

So far I've only had success with 301 redirects, but my goal is to mask things such that wpmu can power the client's blog without revealing its location. Here's my working 301 redirect:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/blog/
RewriteRule ^(.*)$ http://www.mydomain.com/wpmu/clientdomain/$1 [NC]

Is there an easy way to convert it to an internal rewrite? I haven't seen anything but 301 redirects for this type of thing...

Thanks in advance,

Casey

A: 

What you are doing is an internal rewrite.

For a 301 redirect you would have to write [L,R=301]:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/blog/
RewriteRule ^(.*)$ http://www.mydomain.com/wpmu/clientdomain/$1 [L,R=301]
JochenJung
`www.mydomain.com` isn't the domain under which the `RewriteRule` is being performed, so the rule he has will perform an external redirection as he specified.
Tim Stone
Ah, ok, now I get it. Then the only way without revealing the true URI is to act as a proxy.See mod_proxy for example: http://httpd.apache.org/docs/1.3/mod/mod_proxy.htmlOr use symlinks on the filesystemln -s /x/y/z/domains/clientdomain.com/html/blog/ /x/y/z/domains/mydomain.com/html/wpmu/ should help
JochenJung
I wound up using symlinks, rewriting across domains does not work.
Casey
A: 

From what I can tell, the only way to achieve this rewrite across vhosted domains is to use a symbolic link between domains to fool mod_rewrite into thinking it's doing an internal rewrite

Casey