2016-03-07 108 views
-1

我实际上创建一个简单的应用程序使用Silex和我有一些问题。Silex和htaccess到/网

实际上,我运行在Apache 2服务器上,并且在我的应用程序根目录下的ht access中设置了fallback /index.php。

其实,我实际上是让这些种途径:

http://127.0.0.1/appname/web/index.php/route

,我需要这样的东西

http://127.0.0.1/route

我绝对不知道h要继续...

你能帮我一下吗?

+1

这种基本用法总是在doc中。 http://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html – chalasr

+0

只要确保使用* RewriteBase/appname/web * – mTorres

+0

另外,如果您将应用代码放在* appname *里面公开你的代码,这是一个非常糟糕的做法,你的webroot应该是* web *文件夹(唯一的意思是可公开访问)。 – mTorres

回答

1

修改您的.htaccess以更改您的根目录并替换index.php。

RewriteEngine On 
RewriteBase /appname/web 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ %2index.php [QSA]