Website with Slim (Friendly URL)

0

I can not make my site work.

The index page works fine, but the other URLs do not work ...

On my computer (Localhost), the site is running normal, only when I send to FTP (I'm using a free Hostinger account) does not work.

If I try any url outside the index, give the 404 error ...

Does anyone have an idea?

<?php
require 'vendor/autoload.php';

$app = new \Slim\App([
    'settings' => [
        'displayErrorDetails' => true
    ]
]);

$container = $app->getContainer();

$container['view'] = function ($container) {
    $view = new \Slim\Views\Twig('source/', [
        'cache' => false
    ]);

    $basePath = rtrim(str_ireplace('index.php', '', $container['request']->getUri()->getBasePath()), '/');
    $view->addExtension(new Slim\Views\TwigExtension($container['router'], $basePath));

    return $view;
};

/* ============
   Rotas da aplicação
   ============ */

$app->get('/', function ()
{
    echo "Página inicial";
});

$app->get('/hello', function ($req, $response) {
    return $this->view->render($response, 'inicio.twig', [
        'name' => $_SERVER['REQUEST_URI']]);
})->setName('profile');

$app->run();
    
asked by anonymous 13.05.2017 / 23:00

1 answer

0

RewriteBase /

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^ index.php [QSA,L]
    
30.10.2017 / 22:17