Answer the question
In order to leave comments, you need to log in
How to remove duplicate URL in Yii2?
Hello everybody! I decided to display part of the application in a separate module.
Block module.
class BlockController extends Controller
{
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex()
{
return $ this ->render('index');
}
public function actionCreate(){
}
Answer the question
In order to leave comments, you need to log in
/block/block/create - logical url, because this is a module,
write the route handles in the rules
'block/create' => 'block/block/create',
but this is not quite the right approach.
if the url like /block/create is important to you,
then it is better to create another controller CreateController in which to make the actionIndex() { ... } method,
then the page will become available at /block/create
, this is a better solution than to fence the garden in the rules
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question