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.

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

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?