简体   繁体   English

导入URL重写到IIS 7.5

[英]Importing URL Rewrite to IIS 7.5

I am trying to run PimCore via IIS. 我正在尝试通过IIS运行PimCore。 However I am stumped at how to import the .htaccess file. 但是我很困惑如何导入.htaccess文件。 I managed to import all the rules except these two in : 我设法将除这两个规则以外的所有规则导入:

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

It would really help if you folks can show me how to import these into the IIS 7 URL Rewrite engine. 如果您能向我展示如何将它们导入IIS 7 URL重写引擎,那将真的有帮助。

Thanks in advance. 提前致谢。

Here is the full htaccess file : 这是完整的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]

Found this in the logs : 在日志中找到了:

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. 我自己解决了。

In order to fix this routing issue. 为了解决此路由问题。 There is a threefold process for IIS 7.5. IIS 7.5有一个三重过程。 The first thing that needs to be done is that you naturally need URL Rewrite for IIS 7.5. 首先需要做的就是您自然需要IIS 7.5的URL Rewrite。 When this is done, go to the web.config xml file and paste this in. 完成后,转到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>

After doing so, go to IIS manager and go to the site you want to use pimcore on. 这样做之后,转到IIS管理器,然后转到要在其上使用pimcore的站点。 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]

After doing so, click apply and this will allow pimcore's routing to work on your IIS site :) 这样做后,单击“应用”,这将使pimcore的路由在您的IIS站点上可用:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM