mod rewrite - Apache: doing pattern matching and grouping with a RewriteRule leads to the local path instead of getting the URL component -
i'd use rewriterule's pattern path requested , redirect client elsewhere keeping path in resulting redirect. i thought trick: rewriterule. ^(.*)$ http://testserver/test/$1 if user requests foo , send him test/foo (don't worry looping, put rewritecond logic prevent that). to surprise, apache ends http://testserver/foo/var/www/html . did following: /bar /var/www/html/bar i raised log level of mod_rewrite , found out did match, apache expand matching local path of / , /var/www/html , using redirect browser, won't surely work. i tried using [pt] thought prevent expansion, didn't. any idea on how can prevent happening. appreciated. best wiki