duanpuluan0480 2015-11-08 14:46
浏览 27

localhost / silex / web / hello到localhost / silex / hello

So I just started working with Silex and I have this code in index.php in web folder :

<?php
require_once __DIR__.'/../vendor/autoload.php';

$app = new Silex\Application();
$app ['debug'] = true;
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__.'/../views',
));
$app->get('/hello/', function() use($app) {
return 'Hello ';
});

$app->run();

which goes to : localhost/silex/web/hello

I don't want my links to have /web/ in them , for example I want the above link to be localhost/silex/hello

this is my .htaccess (it is in the root , not in the web folder) :

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
  • 写回答

0条回答 默认 最新

    报告相同问题?