M
M
mr-zherart2014-10-12 00:37:02
Yii
mr-zherart, 2014-10-12 00:37:02

How to remove controller name from url in Yii?

Hello, there is a standard site controller, how to remove it from the path using urlManager or htaccess. Well, it is desirable so that the site/programs/program1 type record does not fly off. Thank you!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stanislav Somov, 2014-10-12
@mr-zherart

For yii2
.htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

web.php
....
            'urlManager' => [
            'enablePrettyUrl' => true,
             'showScriptName' => false,
             'suffix'=>'/',
             'rules'=>array(
                 ''=>'site/index',
                 '<action>'=>'site/<action>',
             ),
        ],
...

For Yii1 (no changes to htaccess required)
'urlManager'=>array(
  'urlFormat'=>'path',
  'rules'=>array(
  '<action:\w+>'=>'<controller>/<action>',
  ),
),

J
Justin Bieber, 2016-11-08
@JustinBieber

green is padding

I
iBird Rose, 2016-11-08
@iiiBird

padding there. from .benefit most likely

.benefit{
    width: 100%;
    background: #fff;
    padding: 54px 0;  //этот
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question