malankateam/yii2-url-alias

Yii2 url alias

Installs: 18

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 7

Type:yii2-extension

v0.5.0 2017-10-18 17:42 UTC

This package is auto-updated.

Last update: 2024-11-29 05:32:37 UTC


README

Installation

1. Install Repository

You can install via composer.

Run

php composer.phar require --prefer-dist "robot72/yii2-url-alias" "dev-master"

or add to require section of composer.json:

"robot72/yii2-url-alias": "dev-master"

2. Edit your config files

#####2.1. Check Database Connection Params Check your config/db.php file. Have correct parameters? #####2.2. Install migrations php yii migrate/up --migrationPath=@vendor/robot72/yii2-url-alias/migrations

If you want example data, run this queries:

INSERT INTO `url_rule` (`id`, `slug`, `route`, `params`, `status`) VALUES
(1, '', 'site/index', 'a:0:{}', 1),
(2, 'about', 'site/about', 'a:0:{}', 1);

#####2.3. Edit config/web.php: file

/** Example urlManager config */
'urlManager' => [
    'enablePrettyUrl' => true,
    'showScriptName'  => false,
    'rules' => [
        [
            'class' => 'robot72\UrlAlias\components\BaseUrlRule',
            'connectionID'  => 'db',
            'redirect301'   => true //if you want 301 redirect
        ]
        ...
    ]
],

#####2.4 Test http://YOUR_LOCAL_SERVER/about