Property "CWebApplication.urlManager" is read only.

Hey, guys,

I’m trying the following:

1st - hide index.php by modifiyng .htaccess and using ‘urlFormat’=>‘path’,‘showScriptName’=>false, as the cookbook says

2nd - organize backend and frontend as the cookbook also says :>))

when I access the frontend it works fine, however, when I try to access the backend.php, I get the error

Property "CWebApplication.urlManager" is read only.

What should I do in order to rewrite both ends and get something like this?

mysite.com/contact => contact in frontend

mysite.com/backend/contact => contact in backend

is it possible to hide both index.php and backend.php?

thanks in advance.

You should put urlManager inside ‘components’ item.

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.