Question
I was reading on this site about the fact that I need to modify the view script in order to lock down the /pub folder contents.
There seemed to be two ways to go about this and I was wondering if anyone can let me know the best way to do it, and how... the directions I saw were not exactly clear enough for this noobie...
Environment
--
StevenColbert - 26 Jul 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.
Looks like I'll answer my own question...
Per:
TWikiVMDebianStableCreationLog
Add the following three lines to /twiki/twiki_httpd.conf
RewriteEngine on
RewriteRule ^/twiki/pub/TWiki/(.*)$ /twiki/pub/TWiki/$1 [L,PT]
RewriteRule ^/twiki/pub/([^\/]+)/([^\/]+)/([^\/]+)$ /twiki/bin/viewfile/$1/$2?filename=$3 [L,PT]
--
StevenColbert - 27 Jul 2006
See also
SecuringAttachments.
--
PeterThoeny - 29 Jul 2006
For hosted TWiki where the rewrite rules are in the .htaccess file the mapping rules are are somewhat different. Note the lack of slashes at the start of each path and that this version allows more than one directory level:
RewriteOptions inherit
RewriteEngine On
# set RewriteBase when using in .htaccess; see Apache docs
RewriteBase /twiki
# basically leave /pub/Twiki unchanged
RewriteRule ^pub/TWiki/(.*)$ pub/TWiki/$1 [L,PT]
# send all other /pub/* to /bin/viewfile/<path>?filename=<file>
RewriteRule ^pub/(.*)/([^\/]*)$ bin/viewfile/$1?filename=$2 [L,PT]
ChuckEhrlich - 21 Aug 2006