We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

why my url has public directory

I used $url->get('a'); to make links but my links :


How can I remove public from link?

My root htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule  ^$ public/    [L]
    RewriteRule  (.*) public/$1 [L]

and the dispatcher url

     * The URL component is used to generate all kind of urls in the application
    $di->set('url', function() use ($config){
        $url = new \Phalcon\Mvc\Url();
        return $url;

the base uri : https://localhost/

Can you try:

Phalcon\Tag::linkTo("a", "My Link")

Show you config file or replace:

$url = new \Phalcon\Mvc\Url();
- $url->setBaseUri($config->application->baseUri);
+ $url->setBaseUri('/');


Phalcon is running on my document root. the $url->get() consistently addes "public". when i use $url->setBaseUri('/'), the urls generated then adds "//public//"