A client has a server with Windows 2008 Server installed, running IIS 7.5 and ISAPI 3 (Locaweb hosting).

I needed to put a CakePHP project running on his server, and the problem was the rewrite need of the framework. How I would do the htaccess from CakePHP work on IIS?

First, let’s learn some theory:

On Apache, we use the usa mod_rewrite to read the .htaccess and have friendly URL.
On NGINX, the rewrite support is native, and we configure the files at /etc/nginx/sites-available
On IIS, each version must need something different (sure, Microsoft doesn’t turn things easy), but what is used to do rewrites is ISAPI.

If you are working with IIS 6, maybe you’ll have ISAPI 2, that works with web.config (XML) files.
If you are working with IIS 7 or superior, probably you have ISAPI 3, that works with .htaccess as mod_rewrite from Apache (YEY \o/).

The configuration I did on .htaccess, to the server I described earlier, got like this:

On this configuration, the project lies on the root folder of the server, and not on a subdir. Also deleted the .htaccess from /app and /app/webroot folders, leaving only the root one.

I’m sharing this configuration because it took me a lot of thinking to get the working version, since I’m not a Microsoft lover.

2 thoughts on “CakePHP on IIS 7.5

    1. Eduardo, no caso de um subdomínio, eu imagino que seja tratar igual a forma que se trata diretório raiz.

      A configuração que eu postei não funcionou para subdomínio?

      Se não resolveu, manda um e-mail para mim: heitor-silva [at] hotmail.com.

      Eu tento te ajudar

      abs

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.