【问题标题】:How to install Symfony2 on IIS with ISAPI_Rewrite如何使用 ISAPI_Rewrite 在 IIS 上安装 Symfony2
【发布时间】:2011-12-07 16:09:28
【问题描述】:

对于特定项目,我一直使用 IIS6,并且在使用 ISAPI_Rewrite 时遇到了困难。我使用 symfony1 guide,安装了 ISAPI_Rewrite3,我正在尝试将项目安装为网站域中的子目录(使用虚拟目录)。

mydomain.com 上已经有一个网站,我希望我的项目位于 mydomain.com/myproject 下(没有尾随的 web 文件夹)。所以我在 IIS 中的 mydomain.com 下创建了一个虚拟目录,创建了文件夹 c:\myproject 并将这些行添加到全局 httpd.conf 配置文件中

  # Defend your computer from some worm attacks
  RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]


  # we skip all files with .something except .html
  RewriteCond URL /myproject/.*\..+$
  RewriteCond URL (?!/myproject/.*\.html$).*
  RewriteRule /myproject/(.*) /myproject/$1 [L]


  # we keep the .php files unchanged
  RewriteRule /myproject/(.*\.php)(.*) /myproject/$1$2 [L]


  # finally we redirect to our front web controller
  RewriteRule /myproject/(.*) /myproject/app.php [L]

但是当指向 mydomain.com/myproject 时,一切都会导致找不到 http 404。有人用 IIS6 和 ISAPI_Rewrite 成功安装了 sf2 吗?

【问题讨论】:

    标签: iis-6 symfony isapi-rewrite


    【解决方案1】:

    您有 2 条以相同模式“/myproject/(.*)”开头的规则,这可能会导致问题。 还有一些规则是多余的。请尝试以下配置:

    # we skip all files with .something except .html
    RewriteCond URL (?!/myproject/.*\.html).*
    RewriteRule /myproject/.*\..+ $0 [I,L]
    
    # finally we redirect to our front web controller
    RewriteRule /myproject/.* /myproject/app.php [I,L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-23
      • 2014-05-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-17
      相关资源
      最近更新 更多