将URL重写导入IIS 7.5

时间:2010-11-26 15:39:45

标签: iis iis-7 url-rewriting url-routing iis-7.5

我正在尝试通过IIS运行PimCore。但是我对如何导入.htaccess文件感到困惑。我设法导入了除了这两个规则之外的所有规则:

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]

如果你们可以告诉我如何将这些导入到IIS 7 URL重写引擎中,那将非常有用。

提前致谢。

这是完整的htaccess文件:

RewriteEngine On

RewriteCond %{REQUEST_METHOD} ^GET
RewriteCond %{DOCUMENT_ROOT}/website/var/assets%{REQUEST_URI} -f
RewriteRule ^(.*)$ /website/var/assets%{REQUEST_URI} [PT,L]

RewriteRule ^website/var/tmp.* - [PT,L]
RewriteRule ^website/var/assets.* - [PT,L]
RewriteRule ^plugins/.*/static.* - [PT,L]
RewriteRule ^pimcore/static.* - [PT,L]

RewriteRule ^website/var/.*$ / [F,L]
RewriteRule ^plugins/.*$ / [F,L]
RewriteRule ^pimcore/.*$ / [F,L]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

在日志中找到了这个:

PHP Fatal error:  Interface 'Zend_Controller_Router_Route_Interface' not found in D:\pimcoreroot\pimcore\lib\Zend\Controller\Router\Route\Abstract.php on line 39

1 个答案:

答案 0 :(得分:1)

我自己解决了这个问题。

为了解决此路由问题。 IIS 7.5有三个过程。首先需要做的是你自然需要IIS 7.5的URL Rewrite。完成后,转到web.config xml文件并将其粘贴到。

    <?xml version="1.0" encoding="UTF-8"?>
<configuration>
     <system.webServer>
         <rewrite>
             <rules>
                 <rule name="Imported Rule 1" 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>

执行此操作后,转到IIS管理器并转到要使用pimcore的站点。转到右侧操作面板上的导入规则按钮。在导入规则文本区域(顶部的第一个文本区域)中,将其粘贴到:

RewriteEngine On

RewriteCond %{REQUEST_METHOD} ^GET
RewriteCond %{DOCUMENT_ROOT}/website/var/assets%{REQUEST_URI} -f
RewriteRule ^(.*)$ /website/var/assets%{REQUEST_URI} [PT,L]

RewriteRule ^website/var/tmp.* - [PT,L]
RewriteRule ^website/var/assets.* - [PT,L]
RewriteRule ^plugins/.*/static.* - [PT,L]
RewriteRule ^pimcore/static.* - [PT,L]

RewriteRule ^website/var/.*$ / [F,L]
RewriteRule ^plugins/.*$ / [F,L]
RewriteRule ^pimcore/.*$ / [F,L]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

执行此操作后,单击“应用”,这将允许pimcore的路由在IIS站点上运行:)