The C2MS system is designed to answer for all URLs on a website that do not have a physical on-disk file. This is typically accomplished by setting up an apache configuration mod-rewrite rule as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
RewriteEngine on <Location /> Options +FollowSymLinks -Indexes RewriteEngine on # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # All calls to YII PHP will be direct access without rewrite rules # otherwise URL's will be forwarded to the c2ms content controller # in Yii via the CmsPageController RewriteRule ^(.*)$ /index.php?r=/c2msfoundation/c2msSiteFront/render&__cms_url=%{REQUEST_URI} [L,QSA] </Location> |
This rule routes traffic to the c2msfoundation module’s C2msSIteFrontController’s actionRender method. The actionRender method determines how to handle the URL using the following rules:
- If the request URL matches a physical file on disk, serve via Apache.
- The request URL is checked against the cbmApplicationUrl table and if found handled by an application mount.
- The request URL is checked against the cbmUrl table and if found handled by the block type renderer associated with the block view joined to cbmUrl.
- Active theme checked for error 404 view and if found rendered.
- C2MS default 404 view.