导入URL重写到IIS 7.5 [英] Importing URL Rewrite to IIS 7.5

查看:93
本文介绍了导入URL重写到IIS 7.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to run PimCore via IIS. However I am stumped at how to import the .htaccess file. I managed to import all the rules except these two in :

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

如果您能向我展示如何将它们导入IIS 7 URL重写引擎,那将真的有帮助.

It would really help if you folks can show me how to import these into the IIS 7 URL Rewrite engine.

谢谢.

这是完整的htaccess文件:

Here is the full htaccess file :

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

推荐答案

我自己解决了这个问题.

Solved this myself.

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

In order to fix this routing issue. There is a threefold process for IIS 7.5. The first thing that needs to be done is that you naturally need URL Rewrite for IIS 7.5. When this is done, go to the web.config xml file and paste this in.

    <?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的站点.转到右侧操作面板上的导入规则按钮.在导入规则文本区域(从顶部开始的第一个文本区域)中,将其粘贴到:

After doing so, go to IIS manager and go to the site you want to use pimcore on. Go to the import rules button on the right action panel. In the import rules text area which is the first text area from the top, paste this in :

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站点上运行:)

After doing so, click apply and this will allow pimcore's routing to work on your IIS site :)

这篇关于导入URL重写到IIS 7.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆