BCS Yii2 Pretty URL's

To achieve SEO friendly URL’s for the Yii2 framework can be challenging.  Below you will find an example that works for my Yii 2 application. [codesyntax lang=”php”] ‘urlManager’ => [ ‘enablePrettyUrl’ => true, ‘showScriptName’ => false, ‘rules’ => [ ‘<alias:\w+>’ => ‘site/<alias>’, ‘/’ => ‘site/index’, ‘login’ => ‘site/login’, ‘<controller:\w+>/<id:\d+>’ => ‘<controller>/view’, ‘<controller:\w+>/<action:\w+>/<id:\d+>’ => ‘<controller>/<action>’, ‘<controller:\w+>/<action:\w+>’ […]

BCS Create New Yii 2 With Composer

When a new Yii2 project is required move to the root of your web and issue the following command. [codesyntax lang=”bash”] composer create-project –prefer-dist yiisoft/yii2-app-basic fdoc [/codesyntax] Composer will initiate and build the new project “fdoc”. Two commands should be issued to make directories writable by the web process. b[codesyntax lang=”bash”] chmod 0777 runtime chmod […]

BCS Yii2 Skeleton

The basic web site installation should be modified to enable pretty url’s. Modify config web.php to turn pretty url’s on. [codesyntax lang=”php”] ‘components’ => [ // … ‘urlManager’ => [ ‘class’ => ‘yii\web\UrlManager’, // Hide index.php ‘showScriptName’ => false, // Use pretty URLs ‘enablePrettyUrl’ => true, ‘rules’ => [ ], ], // … ], [/codesyntax] […]