3/8 I have a mod_rewrite question that I think should be straight-
forward but I think I'm not getting something.
I have a virtual server with some root, say /home/user/public_html/
and in there I have two subdirs, say /app1/ and /app2/
and i want the following:
http://mysite/app1 --> /home/user/public_html/app1
http://mysite/(.* --> /home/user/public_html/app2/$1
so for ex, http://mysite/app2 --> /home/user/public_html/app2/app2
So anything that's not "app1" would map into the app2 subdir ...
but I guess this causes an infinite loop in the processing? Since it
just keeps prefixing /app2/ onto the path until it crashes? any
advice? thx -
\_ IIRC it matches in order. However, the way you have it, it looks like
http://mysite/app1 or http://mysite/app1/(.* might not be matched by
your first rule. Perhaps "http://mysite/app1(/.*)?" or something may
work better (untested though, but you should get the idea)
\_ ok sure you're right. But my main question is how to get the
2nd rule to work w/out generating an infinite loop. ie,
http://mysite should go to home/user/public_html/app2/
http://mysite/foo should go to home/user/public_html/app2/foo
http://mysite/app2 should go to home/user/public_html/app2/app2
etc, but w/out infinite loop. possible? thx
\_ Oh, I see. You probably want
http://mysite/app2 -> /home/user/public_html/app2/
as a separate rule, or perhaps...
http://mysite/([^/]*)(/.*?) -> /home/user/public_html/app2/$1$2
...maybe? I don't know why it would be rewriting it to a path on
your filesystem...it's been a while, but I thought it rewrote
URLs, not filesystem paths. I'm just guessing...
\_ set your root to app2. then alias /app1. no mod_rewrite.
\_ hurr durr that would make too much sense. D'oh. --!op |