Hi everyone,

I'm wondering if it's possible to rewrite the current URL to a MD5 hash
of the request URL.

What I'm trying to do is serve "/cache/[MD5 hash of URL].html" when a
request on "/URL" is done. This is for caching dynamic content: if the
MD5 hash file exists, then serve the static file, if not, the
next RewriteRule will call the script to generate the cache.

I tried this:

<If "-z %{QUERY_STRING} && %{REQUEST_METHOD} =~ /GET|HEAD/ && -f
'%{DOCUMENT_ROOT}/cache/%{md5:REQUEST_URI}.html'">

It works, great.

But then I can't figure out how to actually serve this file.

I tried this:

RewriteEngine On
RewriteRule .* "/var/www/cache/%{md5:REQUEST_URI}.html"

But it doesn't work, as "RewriteRule" doesn't seem to recognize the md5
function. I guess it doesn't handle all expressions, and if my guess is
righ the %{name:...} syntax is related to rewrite maps.

When doing this, Apache is trying to request "/var/www/cache/.html".

Is there another way of doing this?

I thought of setting a variable with SetEnvIfExpr, or with RewriteCond,
but they're not designed for that and I don't think that's possible.

If anyone has an idea, please help me :)

Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to