regexmod-rewriteproftpd

Proftpd mod_rewrite not working as expected. How do I make it work correctly?


I'm trying to replace backslashes with regular slashes in FTP requests (anonymous), according to Proftp's how-to:

http://www.proftpd.org/docs/howto/Rewrite.html

When I put the following in one of my Proftpd configs:

<IfModule mod_rewrite.c>
    RewriteEngine on

    # Use the replaceall internal RewriteMap
    RewriteMap replace int:replaceall
    RewriteCondition %m RETR

    RewriteRule (.*) "${replace:!$1!\\\\!/}"
</IfModule>

Then request ftp://mysite.com/coc/test\file.txt, it doesn't work. I don't know what I'm doing wrong.


Solution

  • The Proftpd how-to was incorrect in that you must use 4 backslashes. Use only two backslashes:

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteMap replace int:replaceall
        RewriteCondition %m RETR
    
        RewriteRule (.*) "${replace:!$1!\\!/}"
    </IfModule>