0

我正在尝试将 IIS 7 配置为运行 zend,而无需键入 /public/index.php/。如果尝试使用此 URL http://<>/dev/foundation/SampleZendApp/(这是我的应用程序所在的位置)访问我的应用程序,我会收到以下错误

Message: Invalid controller specified (dev)
Stack trace:

#0 C:\inetpub\wwwroot\Dev\foundation\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 C:\inetpub\wwwroot\Dev\foundation\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#2 C:\inetpub\wwwroot\Dev\foundation\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#3 C:\inetpub\wwwroot\Dev\foundation\SampleZendApp\public\index.php(27): Zend_Application->run()
#4 {main}  

Request Parameters:

array (
  'controller' => 'dev',
  'action' => 'foundation',
  'module' => 'default',

仅当我在它前面添加 /public/index.php 时它才有效。如何在 IIS 中进行更改,以便不再需要键入 /public/index.php?

如果有任何机构可以帮助我,我将非常感激。

谢谢你。

4

1 回答 1

0

在 iis 上有点棘手。

打开你的“Bash”:-) 并执行:

%windir%\system32\inetsrv\appcmd.exe set config ^ -section:system.webServer/defaultDocument /+"files.[value='index.php']" ^ /commit:apphost

未安装时,您必须为 iis 添加“重写”模块:

安装:http ://www.iis.net/download/urlrewrite

最后一步:将 web.config 添加到 webroot(.htaccess 的对应项)

    <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="ZF Rewrite" stopProcessing="true">
          <match url="^.*$" />
          <conditions logicalGrouping="MatchAny">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" pattern="" ignoreCase="false" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" pattern="" ignoreCase="false" />
          </conditions>
          <action type="None" />
        </rule>
        <rule name="Imported Rule 2" stopProcessing="true">
          <match url="^.*$" />
          <action type="Rewrite" url="index.php" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>
于 2013-10-18T04:16:59.560 回答