douzhi7661 2014-03-12 15:21
浏览 131
已采纳

在IIS上运行CakePHP站点时出现Page Not Found错误

I'm trying to run a CakePHP site on IIS7 but keep getting an error that I'm not sure how to fix. I get a Page Not Found message on the homepage and the links don't follow the URL structure as they should - all links have .localhost in the domain segment.

When I load the homepage I get the following error:

Page Not Found

    Error: The requested address '/' was not found on this server.
Stack Trace
APP\Controller\TributesController.php line 20 → TributesController->_checkTribute()
[internal function] → TributesController->beforeFilter(CakeEvent)
CORE\Cake\Event\CakeEventManager.php line 248 → call_user_func(array, CakeEvent)
CORE\Cake\Controller\Controller.php line 670 → CakeEventManager->dispatch(CakeEvent)
CORE\Cake\Routing\Dispatcher.php line 184 → Controller->startupProcess()
CORE\Cake\Routing\Dispatcher.php line 162 → Dispatcher->_invoke(TributesController, CakeRequest, CakeResponse)
APP\webroot\index.php line 109 → Dispatcher->dispatch(CakeRequest, CakeResponse)
ROOT\index.php line 43 → require(string)

I thought it might be a problem with the URLRewrite set-up but i'm not sure as i've played about with the rules (from different search results) and it hasn't halped. Currently that is set to:

       <rewrite>
        <rules>
            <rule name="Rewrite routed access to assets(img, css, files, js, favicon)"
              stopProcessing="true">
                <match url="^(img|css|files|js|favicon.ico)(.*)$" />
                <action type="Rewrite" url="app/webroot/{R:1}{R:2}"
                  appendQueryString="false" />
            </rule>
            <rule name="CakePHP" stopProcessing="true">
                <match url="^(.*)$" ignoreCase="false" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                </conditions>
                <action type="Rewrite" url="index.php" appendQueryString="true" />
            </rule>
        </rules>
    </rewrite>

The database is set-up and should be fine, however i'm not sure if the problem is down to the page expecting a database entry or not. In IIS the website is looking at the top-level root folder not webroot. If I change this the error remains and I loose the styling.

The website (UAT site) is ...

I've checked this question but the solution hasn't worked either: Rewrite rules not working for CakePHP on IIS

I don't have the best knowledge of CakePHP so i'm not sure on the best approach to take.

Many thanks.

  • 写回答

1条回答 默认 最新

  • douying9296 2014-03-12 17:54
    关注

    I think there is no problem with your IIS. You have error on Tributes controller. on your code. or cake configuration file.

    Also make sure that tmp folder is able(have permission) to create its logs and tmp files.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog