Have a unique URL-rewriting situation in Apache.

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




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


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!


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.


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
| improve this answer | |
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.