Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

KarolGil's avatar

Change default path to public folder.

Hi

I have this directory structure for shared hosting.

/sites/site1
/sites/site2
/sites/site3

in the file:  /public/css/app.css mam taki kod:

src: url(/fonts/vendor/simple-line-icons/Simple-Line-Icons.eot?f33df365d6d0255b586f2920355e94d7);

src: url(/fonts/vendor/simple-line-icons/Simple-Line-Icons.eot?f33df365d6d0255b586f2920355e94d7) format("embedded-opentype"), 
url(/fonts/vendor/simple-line-icons/Simple-Line-Icons.woff2?0cb0b9c589c0624c9c78dd3d83e946f6) format("woff2"), 
url(/fonts/vendor/simple-line-icons/Simple-Line-Icons.ttf?d2285965fe34b05465047401b8595dd0) format("truetype"), 
url(/fonts/vendor/simple-line-icons/Simple-Line-Icons.woff?78f07e2c2a535c26ef21d95e41bd7175) format("woff"), 
url(/fonts/vendor/simple-line-icons/Simple-Line-Icons.svg?2fe2efe63441d830b1acd106c1fe8734) format("svg");
  
I get the error:
http://domain.com/fonts/vendor/simple-line-icons/Simple-Line-Icons.woff2?0cb0b9c589c0624c9c78dd3d83e946f6 net::ERR_ABORTED 404 (Not Found)

How can I change it?: http://domain.com/fonts/... on: http://domain.com/sites/site2/public/fonts/...

I am asking for any suggestion on how to do it without assigning url to path in the css file?

0 likes
1 reply
ajithlal's avatar
ajithlal
Best Answer
Level 18

put this in the \App\Providers\AppServiceProvider register() method.

/**
 * Register any application services.
 *
 * @return void
 */
public function register()
{
    // ...

    $this->app->bind('path.public', function() {
//Change the base path to your folder
        return base_path('public_html');
    });
}

Please or to participate in this conversation.