【问题标题】:.htaccess mod rewrite issue under xamppxampp下的.htaccess mod重写问题
【发布时间】:2014-06-08 01:18:11
【问题描述】:

我在我的 xampp 安装中安装了 silex。

我使用下面的.htaccess

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    RewriteBase /Test/web
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

当我访问时

http://localhost/Test/web

我得到了预期的输出,但是当我访问时

http://localhost/Test

我会从 silex 收到以下错误

NotFoundHttpException:找不到“GET /Test/”的路由

路线当然在那里。似乎它认为我想访问路由“/Test”而不是“/”。知道为什么该文件夹仍然通过,即使我已经在 .htaccess 中设置了相应的重写基础?

【问题讨论】:

    标签: php .htaccess symfony mod-rewrite silex


    【解决方案1】:

    尝试将.htaccess 文件放在webroot 文件夹中,例如localhost/myapp/ 并使用FallbackResource /myapp/web/index.php

    查看 Webserver 配置文档:

    http://silex.sensiolabs.org/doc/web_servers.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-03
      • 1970-01-01
      • 2011-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多