As ricardograna said, put your urlManager inside the ‘components’ key in config.php.
My .htaccess looks like this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule backend.* backend.php
# 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
As you can see, all requests that begin with ‘backend’ are handled with backend.php (which contains own configs, controllers, views, etc in backend folder), otherwise it’s considered as frontend.