我为我的应用程序的路由目的使用Silex“微型框架”。 我目前被困在如何用.htaccess重写URL。Silex路由.htaccess webroot
标准Silex的网址:localhost/myapp/web/index.php/hello/name
我希望它看起来像:localhost/myapp/hello/name
用下面的.htaccess代码,我能够省略/index.php/
部分。但我仍然需要使用/web/
部分。
RewriteEngine On
RewriteCond %{THE_REQUEST} /myapp/web/index.php/
RewriteRule ^/myapp/web/index.php/(.*) /myapp/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !/myapp/web/index.php/
RewriteRule ^(.*)$ /myapp/web/index.php/$1 [L]
有什么建议吗? 谢谢!
我陷入了同样的问题。似乎没有任何工作。 – Kandinski 2013-12-15 05:46:04