CakePHP 2.2.2 not working on Windows IIS7

2019-02-16 00:56发布

问题:

I am trying to make CakePHP work over windows with IIS7 and i can not get it following the official documentation: http://book.cakephp.org/2.0/en/installation/advanced-installation.html#url-rewrites-on-iis7-windows-hosts

I have downloaded the rewrite module for IIS7 from here: http://www.microsoft.com/en-us/download/details.aspx?id=7435 And then installed it as admin.

I created the web.config file inside my cakephp main folder as said on the documentation.

The result I'm having is that when i try to load my cakephp main folder with the browser, it tries to load the wellcome.png image of IIS7 (failing to load it) and it doesn't load any project or cakephp content.

If i remove the web.config file from my mail folder, cakephp loads but it shows the the following error:

URL rewriting is not properly configured on your server.    
1) Help me configure it 
2) I don't / can't use URL rewriting

What am I doing wrong? Any idea? Thanks.

回答1:

Ok, i have it working now.

What i had to do, after downloading and installing the rewrite module for IIS7 ( http://www.microsoft.com/en-us/download/details.aspx?id=7435 )

  • Create a new Site in IIS pointing to the CakePHP project folder
  • Import and Apply the .htaccess files using the URL Rewrite Module
    • APP\webroot\.htaccess
    • APP\.htaccess

That's it. Hope this can help anyone :)