caijq4ever/yii2-urlalias

like opencart seo url

Installs: 216

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 3

Type:yii2-extension

dev-master 2017-07-25 10:08 UTC

This package is not auto-updated.

Last update: 2024-05-17 22:02:57 UTC


README

like opencart seo url

Installation

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist caijq4ever/yii2-urlalias "dev-master"

or add

"caijq4ever/yii2-urlalias": "dev-master"

to the require section of your composer.json file.

Usage

1.Edit config/web.php file

'components' => [
    ...
    'urlManager' => [
        'enablePrettyUrl' => true,
        'showScriptName' => false,
        'rules' => [
            [
                'class' => 'junqi\urlalias\UrlRule',
            ],
        ],
    ],
    ...
],

2.Install migrations yii migrate/up --migrationPath=@vendor/caijq4ever/yii2-urlalias/migrations

3.Insert fake data

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

4.Run http://path/to/your/project/hello on your browser

TODO

  • Cache
  • ...