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

Tutorial routing not working

I'm following the on-line tutorial and everything worked as expected until I added the "Sign up here link". I found that the link was not formed properly and fixed that (forum.phalcon.io/discussion/723/url-problem) and now the link looks OK https://webopsdev.ucsd.edu/tutorial/signup. When I click it I get a 404 error. The directory structure and files match the tutorial's. These files are in place: tutorial\app\controllers\SignupController.php tutorial\app\views\signup\index.phtml

I am running IIS7.5 / Win2008 Server / PHP 5.4.14. I imported the tutorial's .htaccess with the IIS console.
What have I missed?

Thanks, Ron



98.9k

Try changing the base URI for your app by setting up the URL component:

$di->set('url', function () use ($config) {
    $url = new Phalcon\Mvc\Url();
    $url->setBaseUri("/tutorial/");
    return $url;
}, true);

In tutorial\public\index.php after $di->set('view', ....... );
$di->set('url', function () { $url = new Phalcon\Mvc\Url(); $url->setBaseUri("/tutorial/"); return $url; }, true);

edited Mar '14

I am having the same issue that Ron has, I tryed the abow commends no use still i am facing the issue when pointing to localhost/tutorial/ i can see app folder and public folder, when i access the public folder i can see the index page then my URL will be localhost/tutorial/public/ my .htaccess file in /tutorial/ is

<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ public/ [L] RewriteRule (.*) public/$1 [L] </IfModule> and the command "a2enmod rewrite" shows that "Module rewrite already enabled" I am using ubuntu elementary os. Am i Following correctly or is there any error in my installation. I am using apache server. please help