0

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!

SeanKilleen
  • 1,073
  • 8
  • 25
  • 38

1 Answers1

0

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
matthew
  • 1,309
  • 1
  • 11
  • 21
  • Hi Matthew, thanks for the response! To my knowledge, mod_rewrite only works on URLs where the browser is going -- not displayed URLs in pages, stylesheets, javascripts, etc. So mod_rewrite would be used largely for redirection. we're using mod_proxy_html because Apache is being implemented as a reverse proxy. – SeanKilleen Feb 17 '11 at 13:58
  • Also, to confirm, the [X] is my placeholder to mean "some character after that string" and no, that slash really is in that format. Thanks for your help! – SeanKilleen Feb 17 '11 at 14:07
  • Oh do you mean rewriting the html output? – matthew Feb 17 '11 at 14:07
  • that's correct. We need to rewrite that string wherever it occurs. We're basically doing a workaround for the way SharePoint 2007 handles URLs. – SeanKilleen Feb 17 '11 at 14:16