douzhi7661
2014-03-12 15:21 阅读 112
已采纳

在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 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.

    点赞 评论 复制链接分享

相关推荐