Apache mod_proxy_html Substitute: how to re-use part of regex match? (regex variables?)

apache-2.2mod-proxyregexregular expressions

Have a unique URL-rewriting situation in Apache.

I need to be able to take a URL that starts with

"\u002f[X]"

or

'\u002f[X]"

Where X is the rest of some URL,
and substitute the text

"\u002fmeis2\u002f[X]

I'm not sure how the Regex works in Apache — I think it's the same as Perl 5? — but even then I'm a little unsure how this would be done. My hunch is that it has to do with Regex grouping and then using $1 to pull the variable out, but I'm entirely unfamiliar with this process in Apache.

Hoping someone can help — thanks!

Best Answer

I'm not sure what the proxy part has to do with this but you can do this with mod_rewrite.

RewriteRule ^/(.*) /meis2/$1

I'm assuming here that by "\u002f" you mean "/" and you mean the brackets "[]" to be part of the substitution and not in the actual URL.

EDIT

Ok, since you mean you want to rewrite the HTML output with mod_proxy_html. Then I think it would be something like this.

ProxyHTMLURLMap ^\\u002f(.*) \u002fmeis2\u002f$1 R