html::img not working


html::img was working fine until I added a .htaccess file.

RewriteEngine on

If a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

Otherwise forward it to index.php

RewriteRule . index.php

How exactly it’s not working?

No images show.

If I remove the url entry from web.php it works.

What’s the URL generated?

<img src="images/TenderPoints.gif" alt="">

use yii\helpers\Html;


 Html::img(\Yii::$app->request->BaseUrl . '/images/TenderPoints.gif', [

'class' => 'img-responsive',

'alt'=>'The Tinder Points SEO Words',

'title'=>'Tinder Points Title'



Also, if you are using shared hosting and your yii app is not in the root i.e. root/YourYii2App/ you will need to change the rewrite base in you .htaccess as well. If you don’t you will only see the home page and no other pages will work.

#Use if on shared hosting and app is not in the root folder directory.

RewriteBase /