I have been trying to get rewrite rules to work on IIS for CakePHP using the following web.config settings which is in the root folder:
I don't have much experience with IIS but, returning to this question, I'm noticing some glaring issues. IIS has imported all the three of CakePHP's .htaccess without any regard as to which directory they are contained in.
CakePHP comes with two additional .htaccess files so that users can easily throw an installation into Apache and, regardless of the URL they try, they should always (hopefully) be redirected to the correct .htaccess file and things should "just work" (TM):
Document root Additional .htaccess file Correct .htaccess file
/ --------------> /.htaccess -----------------> /app/webroot/.htaccess
/app/ ----------> /app/.htaccess -------------> /app/webroot/.htaccess
/app/webroot ---------------------------------> /app/webroot/.htaccess
The way IIS has imported these files, assuming your document root is set to /, rules 3-4 (from the second .htaccess file) are not needed. But more importantly, due to the catch-all regex (.*) in rule 2 (from the first .htaccess file), no rule beyond rule 2 will ever execute - meaning requests will never be passed to index.php.
Anyway, you are not using Apache, so you can't haphazardly throw CakePHP installations around expecting them to just work. The correct document root to use in production environments (for performance and security) on any web server (Apache, IIS, Nginx, etc) is the aptly named /app/webroot directory. This directory contains index.php, static files, and the correct .htaccess file.
After that, all you should need is rule 5 (from the correct .htaccess file). It basically reads: "match all requests and send them to index.php, unless there is a real file or directory we can serve":