Link to home
Start Free TrialLog in
Avatar of paries
paries

asked on

help with a mod_rewrite statement

Hello,
first a litle explanation
i have a directory stucture of

/home/un/a/
/home/un/a/ann
/home/un/b/bob
/home/un/C/
/home/un/C/Charly

i user mod_rewite so bob is http://www.mydom.com/bob

so to get his working i have (all letters.)
   RewriteCond %{REQUEST_URI} !^[a-zA-Z]/
   RewriteRule   ^/A([^/]+)/?(.*)    /A/A$1/$2  [L]
   RewriteCond %{REQUEST_URI} !^[a-zA-Z]/
   RewriteRule   ^/B([^/]+)/?(.*)    /B/B$1/$2  [L]
   RewriteCond %{REQUEST_URI} !^[a-zA-Z]/
   RewriteRule   ^/C([^/]+)/?(.*)    /C/C$1/$2  [L]
   RewriteCond %{REQUEST_URI} !^[a-zA-Z]/
   RewriteRule   ^/D([^/]+)/?(.*)    /D/D$1/$2  [L]

I am  thinking there must be a beteter way to do it
so i thought i would try
RewriteRule   ^/([a-zA-Z])(.*)  /$1/$1$2 [R,L]


but when i do it, mod_rewrite gets in a nasty loop
in the log file i see
 http://www.mydom.com/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/s/sam

thanks for any help

RP
ASKER CERTIFIED SOLUTION
Avatar of caterham_www
caterham_www
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of paries
paries

ASKER

caterham_www

i thought the RewriteRule   was the virtual address not the absolute.  Not sure what you mean by "internal"
yes this is on a linux box so it is case sensitive

> was the virtual address not the absolute.

Yes, you can use an URL-path in per-server context, too

> Not sure what you mean by "internal"

You used the R-Flag: [R,L]. This forces an external redirection.