A
A
AlikDex2015-07-28 16:53:59
Yii
AlikDex, 2015-07-28 16:53:59

How to disable all unnecessary parameters in the url in Yii2, displaying 404?

Actually a subject. Suppose the user writes site.com/index.php?abc=123 instead of site.com/index.php and then there should be a 404 error. The default code is 200.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Smirnov, 2015-07-28
@ap0stal

Yii:$app->request->get() - Returns GET parameter with a given name. If name isn't specified, returns an array of all GET parameters.
www.yiiframework.com/doc-2.0/yii-web-request.html#...
Accordingly, you can write a filter that will track all left parameters and issue a 404 error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question