apache rewrite debian vs windows

cikatomo asked:

I have simple rewrite rules as I just learned about them

RewriteEngine On
RewriteRule ^dl/(.*)/.*$ dl/$1/index.php [L]
RewriteRule ^index.php$ upload.js [L]

both are working on Windows for url localhost/upload/dl/mkdji/index.php, but on Debian works only second rule for url www.domain.com/index.php, but not for www.domain.com/dl/oksoks/index.php
After dl is some random string.
Obviously I’m missing something regarding directory depth, but don’t know what. file htacces is in localhost/upload and root of domain.com folders.
What am I missing here?

My answer:

Probably you need the RewriteBase directive. For example:

RewriteBase /

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.