In Apache's mod_rewrite module there is a feature called RewriteMap. This allows an external program to be called to handle the redirects (allowing for more complicated redirecting).

Is there an equivalent feature for Nginx? I've looked at both the HttpMap and rewrite modules but can't find a way to do this for either.

Any pointers would be great.

link|improve this question
feedback

2 Answers

up vote 0 down vote accepted

Martin F is correct, no exact implementation exists. But you can do this type of setup in multiple ways. You will need to do some searching online, but I can point you in the right direction. I would guess you will need to reimplement your setup, one way or another.

  1. Rewrite URLs to external script, like the way WordPress handles its SEO URLs. If you go this way, look at try_files. Actually this might be the fastest way, regardless of your script language. For example...

    try_files $uri $uri/ /rewritescript.php?q=$uri&;
    
  2. NginxHttpMapModule, check this for some examples i found http://www.ruby-forum.com/topic/197405

  3. Include, check this post http://forum.nginx.org/read.php?2,14117,14321#msg-14321

  4. If you know C, you could always create an nginx plugin.

link|improve this answer
feedback

There isn't exactly the same.

You have to use a 3rd party module such as the lua module to handle the advanced logic.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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