Answer the question
In order to leave comments, you need to log in
Why doesn't routing work in Yii2? on openserver?
In short, I watched the lessons, searched the Internet, found the routing code in yii2:
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
]
],
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
Answer the question
In order to leave comments, you need to log in
The simplest solution:
1. In the open server, enable domain management Manual + Autosearch (you can just manually)
2. Add a domain (for example) test.local, a folder for it \basic\web
Restart the server and everything works!
For the advanced template, I create 2 domains, for example, test.local in the \advanced\frontend\web folder and admin.test.local in the \advanced\backend\web folder.
This config allows you not to fence in .htaccess, but to use the default version.
Well, to check, clear the rules array in the UrlManager config, i.e. 'rules' => []
I’ll add to what Mylistryx wrote , so that it would be easier to transfer it to the server later, we create the mysite folder in the domains folder, the yii folder in it and next to it the public_html folder, we throw the entire framework into yii, everything from the basic / web folder to public_html.
Next:
1. In the open server, enable Manual + Autosearch domain management (you can just manually)
2. Add a domain (for example) mysite .local, the folder for it is \mysite\public_html
3. Edit the paths in index.php, according to the new location
Restart the server and everything works!
Thus, we take the framework out of the public folder, which is good.
Do you have a corresponding actionAbout() action in the SiteController?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question