yii - Urlmanager ignores everything before index.php -
our website
http://test.dobrobut.com/
need redirect
http://test.dobrobut.com/phpbb3/index.php?anything_here
requests 404.
so, here problem.
urlmanager begins apply rules after index.php in request.
can make request
http://test.dobrobut.com/dsfdsf/dsfdsf/dsfdsf/dsf/index.php
or http://test.dobrobut.com/index.php/index.php/index.php/index.php
, lead site/index.
have:
'showscriptname' => false, 'enablestrictparsing' => true, 'enableprettyurl' => true,
so how can redirect requests http://test.dobrobut.com/phpbb3/index.php
404?
you should able use yii's url routing rules accomplish this. in urlmanager configuration specify following:
'showscriptname' => false, 'enablestrictparsing' => true, 'enableprettyurl' => true, 'rules' => [ 'host' => 'http://test.dobrobut.com', 'pattern' => 'phpbb3/index.php', 'route' => 'site/lost', ],
the above configuration route request hits:
test.dobrobut.com/phpbb3/index.php
to 'lost' action of site controller. means have have site controller set in following manner:
use yii\web\httpexception; class sitecontroller extends controller { // lot's of code , other actions here .. public function actionlost() { throw new httpexception(404, 'sorry, requested resource not found'); } }
Comments
Post a Comment