You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ramon Felciano <fe...@yahoo.com> on 2008/10/09 07:18:21 UTC
[users@httpd] Unescaping backreferences in mod_rewrite to embed email address in url?
Hi --
Is it possible to have mod_rewrite unescape backreferences? I would like to
allow users to access resources through a user-specific URLs, created by
embedding a user-provided email address in the URL:
/docs/testuser@yahoo.com
I have a form that allows users to enter their email and submits a GET to a
CGI:
http://www.example.com/cgi-bin/test.cgi?email=testuser%40yahoo.com
I've created a mod_rewrite rule to trap the above pattern and rewrite it:
RewriteCond %{QUERY_STRING} email=([\w@0123456789%\.]+)$
RewriteRule ^/cgi-bin/test.cgi /docs/%1 [PT]
The above is not a very sophisticated email match, but works for this
example. This gives me:
/docs/testuser%40yahoo.com
Is there a way to tell mod_rewrite to un-escape the matched backreference so
I get the @ sign in the URL instead of %40?
Thank you in advance!
Ramon