My local project is working perfectly but when uploading it to hosting, many routes created with Url :: to () are failing me, both with images and with routes to controller actions. Renderpartial doesn’t work for me either.
My project is uploaded to production and commented on the first 2 lines of web / index.php
// defined (‘YII_DEBUG’) or define (‘YII_DEBUG’, true);
// defined (‘YII_ENV’) or define (‘YII_ENV’, ‘dev’);
The folder structure is as it was in local. I don’t know if the production structure needs to be changed.
Url::to(’@web/img/…’) this is correct in production??
It depends on what you mean with “URL does not work”. What exactly is wrong? Is the URL malformed? If yes, so how exactly?
If renderPartial() does not work so how exactly do you call it? Are you using @web as well?
If yes, there might be only one common problem with Aliases. Can you compare your config files on local and production systems?
Yii project can have more config files so you have to check all of them. I would begin in index.php where configuration is loaded using “require” and following is executed:
$config = require __DIR__ . '/../config/web.php';
Aliases are set as follows so search for @web and other not working aliases:
$config = [
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
Let us know and good luck to you …