0

I uploaded a yii2 project to a hosting, while testing the application I noticed that a plugin is not working correctly, checking more in detail and it turns out that the default aliases of yii are not working correctly, that is, it does not show anything.

Example: @web should show / emailsender / web / In this case it does not show it.

This is a screenshot from my localhost: enter image description here

This one from the hosting: enter image description here

im just executing this line to see the alias:

<?php echo Yii::getAlias('@web/'); ?>

The project folder has permissions 0755 as well as subfolders and files like yii.bat and others, permissions 0644.

What could be wrong?. Hope you can help me.

Greetings.

  • That is because on the (i'm assuming) `localhost` you use `localhost/emailsender/web` to access your application, but on the remote hosting, you have a domain name and `rules` (htaccess or nginx) to point you up on the `web` directory right away. In this case alias `@web` will return `/`. – Serghei Leonenco Mar 25 '21 at 04:22
  • @SergheiLeonenco Hey thanks for answer, i dont get it, in .htaccess im just using the yii2 default configuration: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php [L] i tought using the alias i could avoid that kind of configuration – Ernesto España Mar 25 '21 at 04:31
  • `htaccess` for remote server point up right in to the `web` directory. It should work as expected. Check hard coded urls. – Serghei Leonenco Mar 25 '21 at 04:34
  • @SergheiLeonenco well im pointing the domain to the web folder and i print the base url and it shows the domain (http://correosmasivos.telectronicavalero.com) – Ernesto España Mar 25 '21 at 04:55
  • 1
    Empty string as `@web` alias is expected result if your domain is pointed directly into web folder. The problem is either in your plugin configuration or in the plugin itself, but you would need to provide more info about that if you want us to help find problem. – Michal Hynčica Mar 25 '21 at 14:27

1 Answers1

0

Reading Michal answer, the files was pointing between url folder (/var/www/html/...) and not web (http://doman.com/img...), i had to change the configuration of the plugins to the base URL to can access.

Now it works great.

Thanks so much and sorry for bother.

Greetings.