Php Silex routing.htaccess webroot
我使用Silex“micro framework”进行应用程序的路由。 我目前正忙于如何用.htaccess重写url 标准Silex url:Php Silex routing.htaccess webroot,php,.htaccess,routing,silex,Php,.htaccess,Routing,Silex,我使用Silex“micro framework”进行应用程序的路由。 我目前正忙于如何用.htaccess重写url 标准Silex url:localhost/myapp/web/index.php/hello/name 我希望它看起来像:localhost/myapp/hello/name 使用下面的.htaccess代码,我可以省略/index.php/部分。但是我仍然必须使用/web/部分 RewriteEngine On RewriteCond %{THE_REQUEST} /mya
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]
有什么建议吗?
谢谢 像这样的事情应该可以做到:
RewriteEngine On
RewriteBase /
RewriteRule ^myapp/web/index.php/ /myapp/ [R=301,L]
RewriteRule ^myapp/ /myapp/web/index.php/ [L]
发件人:
选项-多视图
重新启动发动机
重写数据库/网络
重写cond%{REQUEST_FILENAME}-F
重写规则^index.php[QSA,L]
正确的做法是将您的
DocumentRoot
设置为/path/to/your/app/web
我遇到了一个类似的问题,解决方法如下
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)? index.php/$1 [QSA,L]
RewriteRule ^/?$ /web/ [R=301]
</IfModule>
选项-多视图
重新启动发动机
重写数据库/网络
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
是否重写规则^(.*)?index.php/$1[QSA,L]
重写规则^/?$/web/[R=301]
我现在面临同样的问题,解决方案是将.htaccess内容更改为:
FallbackResource /index.php
所以在你的情况下是这样的
FallbackResource /web/index.php
这对我很有用,我希望有人会觉得它有用。我也遇到了同样的问题。似乎什么都不起作用。好吧,只适用于Apache>=2.2.16
FallbackResource /web/index.php