Can urlManager routing requests and physical Apache folders co-exist?

So my app is setup to route requests through a slug, so


so /someurl/ redirects to the site controller. This is all well and good, however as soon as I physically create a folder called ‘someurl’ via ftp, I get a Forbidden error, which of course means that Apache is trying to route the request and yii doesn’t touch it. Is there a way to to have physical folders and still have yii handle the routing?

Try adding into .htaccess file so Apache will dispatch all requests to Yii and will not check for directory existance. Haven’t tested it but I’d try to do it this way. You won’t be able to access any files since all requests will be routed to index.phpwith the path as $_GET[‘param’]

<IfModule mod_rewrite.c>

  RewriteEngine On

  RewriteRule ^(.*)$ index.php?param=$1 [QSA,L]


You should try to avoid naming Yii action paths in a way that could be mixed with directory structure though.


Hmm… yeah it’s just to store user specific assets, so /someuser would show the profile page of that user, but the assets would also reside in /someuser/assets/ . I’m migrating an old site, trying to keep the same structure, not sure why tho ;) Guess a better solution would be to keep the user assets in the ‘assets’ folder or is that bad practice? Where would one usually upload user files?