【发布时间】:2013-03-05 20:39:32
【问题描述】:
我正在使用 Silex“微框架”来为我的应用程序进行路由。 我目前被困在如何用 .htaccess 重写 url。
标准 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]
有什么建议吗? 谢谢!
【问题讨论】:
-
我遇到了同样的问题。似乎没有任何效果。
标签: php .htaccess routing silex