Does the Dispatcher work with setBaseUri ?


i´ve set my BaseUri to "/" because phalcon coudn´t find it by itself. But does it have any effects to the dispatcher manipulation ?

Greetz Marc

Hi Marc -

What is the actual base URI of your application? It's usually best to use a fullly qualified URI like "http://localhost/phalcon/". I'm not quite sure I understand what you mean by "does it have any effects to the dispatcher manipulation". As far as I know, the base URI affects the URLs in your routes and thus sent by your dispatcher. So if you created a route:

$route->add('/blog/{$year}/{month}/{title}', array(
    'controller' => 'posts',
    'action' => 'show'

and called ->forward() from your dispatch service, it would forward to BASEURI/blog/year/month/title.

Hey Mike,

my base URI is "/". Has this manually set base URI any effects on my own executeBeforeRoute function ? I try to do my own ACL thing but it doesn´t work yet :S

I mean, what URL do you navigate to when testing your phalcon application?

I manually set my base URI to be either "http://localhost/projectname/" or "" depending on the environment. The base URI shouldn't affect executeBeforeRoute, that's just a event that triggers before Phalcon determines the route. If you have any code you've written, please post it!


I set up an vHost for my Application, so i navigate to http://sandbox:8888/. But the Problem was, that without setting the base URI to "/" i was not able to navigate through my pages. I always had the "public" in my url. i think its a rewrite problem, but i really can´t figure out where the problem is. I use all .htacces files and have AllowOverride set to All, mod_rewrite is turned on and anything should be Ok but it isn´t :) . So then i tried the set base URI to "/" and it worked for me. Now i try to configure an ACL list and had some trouble with it, so thats why i was thinking about that again.


check my post without setbaseuri the tag function will output http://localhost:8000/index.php/uri and the routing all map to index.php...

Look if i do this:

    $di->set('dispatcher', function() use ($di) {

        //Obtain the standard eventsManager from the DI
        $eventsManager = $di->getShared('eventsManager');

        //Instantiate the Security plugin
        $security = new Security($di);

        //Listen for events produced in the dispatcher using the Security plugin
        $eventsManager->attach('dispatch', $security);

        $dispatcher = new Phalcon\Mvc\Dispatcher();

        //Bind the EventsManager to the Dispatcher

        return $dispatcher;

My View is broken ! It´s just nothing on my screen anymore ?!?!?! I really can´t understand this :(

oooooooooooh maaaan ! Sometimes i´m a little stupid :D found the problem right now ....

i did a simple mistake in naming my files ...

Thanks to all for helping me ;)