Per Slegt
Per Slegt

Reputation: 1

Phalcon cannot find controller. Error 404 Not found

I started with a phalcon project and used this tutorial (https://docs.phalcon.io/3.4/en/tutorial-base#basic). But i've got a problem with my controllers.

In my index controller i have:

echo $this->tag->linkTo(
    'signup',
    'Sign Up Here!'
);

But when i click on Sign Up Here! i get the error message "The requested URL /signup was not found on this server."

I think it has something to do with this part of code, but it looks correct to me.

$di->set(
    'url',
    function () {
        $url = new UrlProvider();
        $url->setBaseUri('/');
        return $url;
    }
);

It's not even showing my exception

$application = new Application($di);

try {
    // Handle the request
    $response = $application->handle();

    $response->send();
} catch (\Exception $e) {
    echo 'Exception: ', $e->getMessage();
}

I followed the tutorial on youtube as well and did everything in exact the same way as he did in the video. So i was wondering if anyone can help me out here.

file structure

Thanks

Upvotes: 0

Views: 653

Answers (1)

Arthur
Arthur

Reputation: 413

Looks like you are missing the main .htaccess file in the public folder:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^((?s).*)$ index.php?_url=/$1 [QSA,L]
</IfModule>

And this could be the reason why the exception is not being generated.

Upvotes: 1

Related Questions