Hi,
I have read a lot of messages about running Cake PHP on IIS webserver. I was able to make it working using IIS_Rewrite Lite (http://www.isapirewrite.com/) with the following environment/settings/changes:
1. Create a new website on IIS pointing to /app/webroot folder. 2. Install IIS_Rewrite Lite and configure the httpd.ini file as follows:
[ISAPI_Rewrite]
RewriteCond (?!.*STATIC_REWRITE).* RewriteRule ^(.*)$ /index.php?url=$1 [L]
3. Enable the IIS_Rewrite Lite in the IIS ISAPI Filters. 4. Open the /app/webroot/index.php file and replace the all the lines from "require CORE_PATH.'cake'.DS.'bootstrap.php';" with the following code:
/* IIS Workaround */ if (isset($_GET['url']) && preg_match('/Microsoft-IIS/i', $_SERVER['SERVER_SOFTWARE']) && preg_match('/\?(.*)$/si', $_GET['url'], $matches)) { parse_str($matches[1], $_GET); } unset($matches); /* /IIS Workaround */
require CORE_PATH.'cake'.DS.'bootstrap.php';
if(isset($_GET['url']) && $_GET['url'] === 'favicon.ico') { } /* IIS Workaround */ elseif (isset($_GET['url']) && file_exists(dirname(__FILE__) . $_GET['url'])) { header('Location: ' . $_GET['url'] . '?STATIC_REWRITE'); exit(); } /* /IIS Workaround */ else { $Dispatcher= new Dispatcher (); $Dispatcher->dispatch($url); }
if (DEBUG) { echo ""; }
Please refer any bug/problem.
Không có nhận xét nào:
Đăng nhận xét