question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Url Rewrite and Mod Rewrite Maps

See original GitHub issue

Both RewriteMap in mod_rewrite and rewriteMap in UrlRewrite are not supported in our rewrite module. From the initial scraping of examples, both of these features were rarely used, but it would be a nice addition. From apache:

The RewriteMap directive defines an external function which can be called in the context of RewriteRule or RewriteCond directives to perform rewriting that is too complicated, or too specialized to be performed just by regular expressions. The source of this lookup can be any of the types listed in the sections below, and enumerated in the RewriteMap reference documentation.

Ex: RewriteMap MapName MapType:MapSource

From IIS:

A rewrite map is an arbitrary collection of name-value pairs that can be used within rewrite rules to generate the substitution URL during rewriting. Rewrite maps are particularly useful when you have a large set of rewrite rules and all of these rules use static strings (that is, when there is no pattern matching used). In those cases, instead of defining a large set of simple rewrite rules, you can put all the mappings into the rewrite map as keys and values between the input URL and the substitution URL. Then, to look up the substitution URL based on the input URL, you will have one rewrite rule that references the rewrite map.

Ex:

<rewriteMap name="MyRewriteMap" defaultValue="">
    <add key="a.html" value="b.html" />
</rewriteMap>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
jkotalikcommented, Nov 5, 2020

Okay, going to close this then 😄

1reaction
eswanncommented, Oct 18, 2016

I’m very interested in this feature as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Rewrite Maps in URL Rewrite Module
A rewrite map is an arbitrary collection of name and value pairs that can be used within rewrite rules to generate a substitution...
Read more >
URL Rewrite : The Official Microsoft IIS Site
IIS URL Rewrite 2.1 enables Web administrators to create powerful rules to ... rewrite maps, rule validation, and import of existing mod_rewrite rules....
Read more >
mod_rewrite - Apache HTTP Server Version 2.4
The mod_rewrite module uses a rule-based rewriting engine, based on a PCRE regular-expression parser, to rewrite requested URLs on the fly. By default, ......
Read more >
How to Configure mod_rewrite {With 5 Practical Examples}
mod_rewrite helps rewrite URLs. Learn how to set up and get started with URL rewriting through useful examples in this guide.
Read more >
Rewrite Rule with Rewrite Map - iis
I got a problem with the creation of rewrite rule which is using a rewrite map in IIS. The goal is to rewrite...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found