yii runs controller/action when file esists

why yii is trying to run controller/action in this case?

the requested file exists and my htaccess is:


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

with debug I’ve noticed that this happens with no matching rules in urlManage

this is strange also because I have other files in this directory and they are served as they should be

As your .htaccess says: When it is a File or directory, do not redirect to index.php if the requested file or directory does not exist, call index.php.

In your case the browser is trying to get a non existing asset file and because there is no file it redirects the request to index.php which now tries to resolve the request and fails since of course there is no such action.

you are my glasses tonight :rolleyes:

it seems that working for 12 hours straight is not good for eyesight :blink:

why if I use Yii::app()->assetManager->getPublishedUrl(…) and the directory does not exist Yii returns the url instead of False?

Are you talking about the original directory or the published directory? Why are you trying to get published url for a non existing directory?

I’m talking about the published directory

getPublishedUrl sould return false if the directory does not exists, instead I see that returns the path

getPublishedUrl will return false if the path of which you want to get the url does not exist. You can call that method before and after you published the files and will always get the url where it will be found after publishing.

http://www.yiiframework.com/doc/api/1.1/CAssetManager#getPublishedUrl-detail

from the CAssetManager class reference:

This is confusing

You should read the sentence to it’s end :wink: