如何编辑我的 .htaccess 以便 Silex 获得正确的路径?

How to edit my .htaccess so that Silex gets the right route?

将 Silex 上传到我的网络服务器后,我遇到了一些问题,因为它抓住了错误的路线:

No route found for "GET /Escape/public/"

它应该抓取 "GET /",因此我认为它可以通过 .htaccess 修复,目前看起来像这样:

Options -MultiViews
RewriteEngine On
#RewriteBase /path/to/app
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^Escape/public/ index.php [QSA,L]

我的 URL 看起来像这样: www.MyWebsite.nl/Escape/public/#route

我希望这个 .htacces 已经为我完成了工作,但是......它没有:(
我必须如何重写才能让 Silex 选择正确的路由调用?

试试下面的代码:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.(?:css|js|map|jpe?g|gif|png)$ [NC]
RewriteRule ^(.*)$ /index.php?path= [NC,L,QSA]