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

why my url has public directory

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

https://localhost/public/a

How can I remove public from link?

My root htaccess:

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

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();
        $url->setBaseUri($config->application->baseUri);
        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('/');


1.8k

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