php – Silex路由.htaccess webroot
发布时间:2020-12-13 16:50:09 所属栏目:PHP教程 来源:网络整理
导读:我正在使用Silex“微框架”来进行应用程序的路由. 我目前仍然坚持如何使用.htaccess重写网址. 标准Silex网址:localhost / myapp / web / index.php / hello / name 我希望它看起来像:localhost / myapp / hello / name 使用以下.htaccess代码,我可以省略/i
我正在使用Silex“微框架”来进行应用程序的路由.
我目前仍然坚持如何使用.htaccess重写网址. 标准Silex网址:localhost / myapp / web / index.php / hello / name 我希望它看起来像:localhost / myapp / hello / name 使用以下.htaccess代码,我可以省略/index.php/部分.但我仍然需要使用/ web / part. 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] 有什么建议? 解决方法
我现在面临同样的问题,解决方案是将.htaccess内容更改为:
FallbackResource /index.php 所以在你的情况下它会 FallbackResource /web/index.php 这对我有用,我希望有人会发现它很有用. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |