Struggling with directory structure

Hi all,

I’ve organized my Yii files on my host in a particular way (and it works) but there is one last thing that bugs me.

Here is what I have so far :

  • The framework itself and the db (sqlite) are stored outside the document root

  • The application (blog) is in webroot/blog/

  • The bootstrap file index.php is in the webroot, $yii and $config having the correct paths.

  • In order for this setup to work, I had to add the following code to my main.php :






I did all of this because I wanted the URL to fetch the code in (and not actually displaying At first I used .htaccess and rewriterules, but it kept redirecting me to

So now it works the way I want it, except that when I go to, I’m getting the index of the whole directory (assets, css, scripts and themes). I tried to put a “deny from all” htaccess, just like in the protected folder, but then I lose all my CSS design because webroot/blog/css becomes forbidden…

Any suggestions ?

PS : I tried to access the css folder of the online blog demo, but they managed to protect it. How did they do without losing their design ?

Add the following to htaccess

IndexIgnore *

(I think)

(I used IndexIgnore / in webroot)


Well it works, but the page is neither "forbidden" or "not found". Is there a way to achieve this ?

Nevermind, I found it : "Options All -Indexes" in a .htaccess placed in document root.

Thanks for your help, Tommy!

Also, for those who want to have the same directory structure as me, I forgot to mention that I had to edit the assetManager basePath by adding this to my config file :