Question
hi,
just installed 4.0.4-2 and is trying to get twiki to authenticate my /twiki/pub/ directory this works fine for non-hierical webbs but for hierical webbs I have problems (followed
TWikiAccessControl -> Controlling access to Attachments).
Here are some some snippets from the rewrite.log (running apache 1.3).
- Using non-hierical webbs (OK):
I try to get "/twiki/pub/One/WebHome/data.zip" this gets rewritten by apache to "/twiki/bin/viewfile/One/WebHome?filename=data.zip"
Download is successful.
- Using hierical webbs (problem):
I try to get "/twiki/pub/One/Two/WebHome/data.zip" this gets rewritten by apache to "/twiki/bin/viewfile/One/WebHome?filename=data.zip"
for some reason the "Two"-webb is lost when sent to viewfile thus viewfile cant find file.
Is it my apache or is it the regexp that causes the problems?
Summary
Regexp (from doc mentioned above):
RewriteRule ^/+twiki/+pub/+([^/]+)/+((([^/]+)/+)+)(.+) /twiki/bin/viewfile/$1/$4?filename=$5 [L,PT]
To be rewritten: /twiki/pub/One/Two/WebHome/data.zip
Received: /twiki/bin/viewfile/One/WebHome?filename=data.zip
Expected: /twiki/bin/viewfile/One/Two/WebHome?filename=data.zip
Environment
--
TWikiGuest - 07 Aug 2006
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
fyi I got it working when I changed to:
RewriteRule ^/+twiki/+pub/+(.+)/*/(.+) /twiki/bin/viewfile/$1?filename=$2 [L,PT]
In apache config, but I'd really would like to know if this is a problem in my installation, twiki or apache.
--
TWikiGuest - 07 Aug 2006
It's just a problem to determine, which part of the uri is the web, which one the topic and which one the filename.
I would use something like this:
RewriteRule ^/+twiki/+pub/+([^/]+(/+[^/]+)*)/+([^/]+)/+(.+) /twiki/bin/viewfile/$1/$3?filename=$4 [L,PT]
--
HolgerJust - 01 Oct 2006
Holger, this assumes a flat web structure. The regex needs to be changed if you have sub webs.
--
PeterThoeny - 01 Oct 2006
Hi,
Have a look at
SecuringAttachments , The approach is different from mod_rewrite stuff- Look at my comments at the end of the topic. I have also attached perl module which helps to check the ACL of topic(hence attachments).
--
SopanShewale - 04 Oct 2006
See also
ViewFileNotWorkingWithNestedWebs. The new regex I came up with is:
RewriteRule ^/+twiki/+pub((/+[^/]+)+)/+(.+) /twiki/bin/viewfile$1?filename=$3 [L,PT]
--
BenWheeler - 25 Sep 2007