简体   繁体   English

.htaccess mod在xampp下的重写问题

[英].htaccess mod rewrite issue under xampp

I installed silex on my xampp installation. 我在xampp安装中安装了silex。

I use the following .htaccess 我使用以下.htaccess

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

When i access 当我访问

http://localhost/Test/web

i get the expected output, but when i access 我得到了预期的输出,但是当我访问时

http://localhost/Test

i will get the following error from silex 我将从silex得到以下错误

NotFoundHttpException: No route found for "GET /Test/" NotFoundHttpException:找不到“ GET / Test /”的路由

The route is there of course. 当然有路线。 It seems that it thinks that i want to access the route "/Test" instead of "/". 似乎它认为我想访问路由“ / Test”而不是“ /”。 Any idea why the folder is still passed, even though i have set the according rewrite base in the .htaccess? 知道为什么即使我已经在.htaccess中设置了相应的重写基础,为什么仍然通过该文件夹?

Try putting the .htaccess file in the webroot folder, for example localhost/myapp/ and use FallbackResource /myapp/web/index.php . 尝试将.htaccess文件放在webroot文件夹中,例如localhost/myapp/并使用FallbackResource /myapp/web/index.php

Take a look to the Webserver Configuration documentation: 看一下Webserver配置文档:

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

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

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