Feature #443

[PATCH] mod_redirect: Add support for url-encoding backreferences, map %%n->%n, $$n->$n

Added by Anonymous over 11 years ago. Updated 12 months ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
Missing in 1.5.x:


Attached is a simple user-contributed (e.g. no guarantees) patch to expand the capabilities of mod_redirect for lighttpd 1.4.8.

It adds two features:

  • optional url-encoding for backreferences
  • allow backreference character usage without substituting a backref.

Here is an example of the first case:

Let's say that you want to map the specified URL into a CGI argument, but you want it to be escaped properly --

 url.redirect = ( "^(.*)$" =>

If a user requests "", they will be redirected to "".

Now let's say you want to include an absolute address so that the user is redirected to a different site, You would want the redirection to result in the following URL: "".

The second change allows you to do this with mod_redirect:

 url.redirect = ( "^(.*)$" =>

Using double percents, mod_redirect will no longer assume that the %3 in %%3A is a poor backreference and it will print out the desired single %.


Doh - it looks like I need to attach after I file the ticket. If I have a problem with it, I will put it on the wiki as an attachment.

-- will

mod_redirect_expansion-1.4.8.patch (2.61 KB) mod_redirect_expansion-1.4.8.patch mod_redirect url-encode and %%/$$ patch -- will Anonymous, 2006-01-06 08:44
ticket-443.patch (11.2 KB) ticket-443.patch moo, 2006-04-16 11:31

Related issues

Related to Bug #911: Need for URL encoding in mod_redirect and possibly mod_rewriteNeed Feedback


#1 Updated by moo over 11 years ago

  • Status changed from New to Assigned

assign to me. applies to mod_rewrite too. anyone else have another character against the '!' ?

#2 Updated by moo about 11 years ago

patch pending

#3 Updated by moo almost 10 years ago

cannot be done in 1.4.x unless r1094 is merged back to browser:branches1.4.x, need discussion for 1.5

#4 Updated by Anonymous over 9 years ago

This site could really benefit from some, any, spam prevention.

#5 Updated by Anonymous over 9 years ago

Fixed spam changes

-- raja

#6 Updated by gstrauss 12 months ago

  • Related to Bug #911: Need for URL encoding in mod_redirect and possibly mod_rewrite added

#7 Updated by gstrauss 12 months ago

  • Assignee deleted (moo)

#8 Updated by gstrauss 12 months ago

  • Target version deleted (1.5.0)

Also available in: Atom