0
votes

I am facing a grate problem in my project. When i browse url with my project name than it's show folders, but i don't want to show those folder i want to show direct my web site, like 'localhost/mywebsite/admin'.

I also try to solve this problem to add my backend/config/main.php file

'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => 'false'
],

but it does not work. Please help me to solve this problem.

1
Oh sorry, I didn't mean that. I mean In YII 2.0 advanced application, how to configure or customize URL for backend application - Sohel Rana

1 Answers

0
votes

Customize URL:

   'urlManager' => [
                'enablePrettyUrl' => true,
                'showScriptName' => false,
                'enableStrictParsing' => true,          
                'rules' => [
                    '<_c:[\w\-]+>' => '<_c>/index',
                    '<_c:[\w\-]+>/<_a:[\w\-]+>' => '<_c>/<_a>',
                    '<_c:[\w\-]+>/<_a:[\w\-]+>/<id:\d+>' => '<_c>/<_a>',
                ],
            ],

In apache.conf input DocumentRoot /var/www/backend/web.