php - Simple URL Yii2 -


project yii2 basic [v2.0.12]:

.htaccess

options +followsymlinks indexignore */* rewriteengine on adddefaultcharset utf-8  rewritecond %{request_url} !^/(web) rewriterule ^assets/(.*)$ /web/assets/$1 [l] rewriterule ^css/(.*)$ /web/css/$1 [l] rewriterule ^fonts/(.*)$ /web/fonts/$1 [l] rewriterule ^js/(.*)$ /web/js/$1 [l] rewriterule ^images/(.*)$ /web/images/$1 [l] #rewriterule (.*)$ /web/$1 rewriterule ^(.*)?$ /web/$1 [l]  rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /web/index.php 

and

web/.htaccess  rewriteengine on  rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d  rewriterule . index.php 

config\web.php

'baseurl' => '', 'urlmanager' => [     'enableprettyurl' => true,     'showscriptname' => false,     'rules' => [         // ...     ], ], 

not working.. why?! not understand why not working.. , tell me please mistake?

enter image description here

please set base url in config/web.php

use \yii\web\request;  $baseurl = str_replace('/web', '', (new request)->getbaseurl()); $params = require(__dir__ . '/params.php');  $config = [ 'components' => [ 'request' => [             //define rest api. response should json format             'parsers' => [                 'application/json' => 'yii\web\jsonparser',             ],             // !!! insert secret key in following (if empty) - required cookie validation             'cookievalidationkey' => 'basic',             'baseurl' => $baseurl,         ], ], 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -