Question: Is the files directory within your webspace? If it is, is this .htaccess in your DocumentRoot (directory above files)? If not, delete the start anchor in the RewriteRule, too.
Your mod_rewrite code is written for both Apache 1.x and Apache 2.x - which are mutually exclusive so it will never work as is. Which version are you using? If your’e not sure, replace the ^ (Apache 2.x version) and ^/ (Apache 1.x version) with ^/? as that will work for both versions.
I’m sure that the solution is relatively simple but you’ve not provided sufficient information (nor answered the question about files vs DocumentRoot). It also appears that you have Options +MultiViews enabled so I have to ask for:
Your WEBSPACE’s directory structure (as applies to this question), specifically noting the location of DocumentRoot, files, buy, customer, account and login directories. While you’re at creating this “map,” WHERE is the index.php? I suspect that customer and login are “pseudo” directories of your CMS but that needs to be confirmed.
Show your FULL .htaccess file(s) in the path to index.php and to your login directory.
I’m NOT familiar with Magento but it should work the same as WordPress (where its index.php include()s all relevant modules depending upon the requested URI. That being said, the only thing necessary here is to get the customer/login/ to the index.php file (which should be merely directing to the index.php as it should read the original URI).
It just takes me to my /index.php so I’m assuming ^buy/ didn’t work at all since it went to a fallback page.
All the other combinations leads me to the Magento main page, but Magento says it can’t find the file (Magento 404 page) even though when I try it with /files/buy/index.php/url/ it will work. My .htaccess is explicitly telling Apache to go there with just /buy/ instead of /files/buy/index.php/ but it only works with the latter for some reason despite the rewrite rules and regex looking (seemingly) correct.