We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Problem with tutorial

Hi I have set up Phalcon with no issues, but when following the tutorial I've come across a problem. When setting up IndexController with a view everything works fine, but when setting up SignupController, it says the page cannot be found. I have checked all code, double check, I pasted all the code from web site in case of a typo. It looks like it will go the index controller only and no other. I have check all permission on server, even tested with chmod to 777 just in case. The browsers response with page not found in chrome develoment tools. Can't see where problem lies.

Thanks G Smith

By default, the Phalcon router uses $_GET[_url]. If you want to change that behavior to https://host/:controller/:action/:params, you'll need to instantiate an instance of the \Phalcon\Mvc\Router. The example below shows how it done with the DI:

$di->set(
    'router',
    function () {
        $router = new \Phalcon\Mvc\Router();
        $router->setUriSource(
            \Phalcon\Mvc\Router::URI_SOURCE_SERVER_REQUEST_URI
        );

        return $router;
    }
);

See the routing section of the offical docs for more information. Hope that helps!

-Brian



33.8k

Create a virtual host whose DocumentRoot is path/to/your/app/public.

Always remember to do that. This isn't the first time someone post something like this.



632

Create a virtual host whose DocumentRoot is path/to/your/app/public.

Always remember to do that. This isn't the first time someone post something like this

Hi I did set the DocumentRoot to path/to/your/app/public. This is why I can't understand why it does not work. It only goes the index controller, but no other. I then decided to have a go at Tutorial 2, the same thing happend, the index page loads, but no css or images are loaded. I think rewrite does not seem to redirecting. phpinfo is saying that rewrite is loaded, not sure why. Will try to resolve.



33.8k

Show your .htaccess (that has to be in your public folder).