Hi All,
I would need some help with mod_rewrite :-( .
What I would need is to add an header to the response if the request contains a URL parameter and the value of that parameter should be used in that header.
Just to clarify, if the url is:
/download/files/1ytreefecsw?filename=myfile.txt
I would like to return this file /download/files/1ytreefecsw setting in the response "Content-disposition" header with value myfile.txt:
"Content-disposition: attachment; filename=myfile.txt
I was able to do this thing checking a request header using:
SetEnvIf x-filename "^(.+)$" FILENAME=$1
Header set "Content-disposition" "attachment; filename=%{FILENAME}e" env=FILENAME
but now i need to do similar thing using a parameter.
I understand that there is not a simple way to access to the query_string and actually this is not possible using SetEnvIf and it seems the right way is using mod_rewrite .... but i don't find the solution.
At the moment i'm trying something like:
RewriteEngine on
RewriteRule ^(.*)filename=(.*)$ $1 [E=FILENAME:$2]
Header set "Content-disposition" "attachment; filename=%{FILENAME}e" env=FILENAME
but it doesn't work :-((
Could you help me ?
Thanks
ste
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
" from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx