When you visit another page, what's the URL in the bar look like?
It should be 127.0.0.1/login, not 127.0.0.1/login.php.
If it's going to anything with a .php extension, then MAMP is ignoring the .htaccess file.
I found this article on potentially fixing this. Remember that after each change, you must restart the server to see the effects. I hope you've been doing that between each fix I've suggested?