A
A
Alexander Ivanov2017-04-17 19:47:18
Yii
Alexander Ivanov, 2017-04-17 19:47:18

How to remove default from yii2 module?

Example url:
site.ru/module/

'<action>'=>'site/<action>',
                '<module:\w+>/<action:\w+>/<id:(.*?)>' => '<module>/default/<action>/<id>',
                '<module:\w+>/<action:\w+>' => '<module>/default/<action>/',
                '<module:\w+>/' => '<module>/default/',

the bottom three lines of the result do not give
here .htaccess
addDefaultCharset utf8
Options +FollowSymLinks
IndexIgnore */*
# If a directory or a file exists, use it directly
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward it to index.php
RewriteRule . index.php

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-04-17
@cimonlebedev

'<module:\w+>/<action:\w+>/<id:(.*?)>' => '<module>/default/<action>/<id>', //тут лишнее <id>'
//надо так:
'<module:\w+>/<action:\w+>/<id:(.*?)>' => '<module>/default/<action>',

and there are a lot of slashes, in short, try this:
'<action>'=>'site/<action>',
'<module:\w+>/<action:\w+>/<id:(.*?)>' => '<module>/default/<action>',
'<module:\w+>/<action:\w+>' => '<module>/default/<action>',
'<module:\w+>' => '<module>/default/index',

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question