Step 1 : edit common/config/main.php as below
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
],
Step 2 : Add following .htaccess file into backend/web folder
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
Step 3 :Add following .htaccess file into frontend/web folder
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
Step 4: Add following to apache\apache2.4.9\conf\extra\httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "D:\Projects\new\yii-application"
ServerName yii2_test.ml
<Directory "D:\Projects\new\yii-application">
AllowOverride All
</Directory>
</VirtualHost>
Step 5: Enable mod_rewrite on apache\apache2.4.9\conf\httpd.conf
'urlManager' => [
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
],
Step 2 : Add following .htaccess file into backend/web folder
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
Step 3 :Add following .htaccess file into frontend/web folder
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
Step 4: Add following to apache\apache2.4.9\conf\extra\httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "D:\Projects\new\yii-application"
ServerName yii2_test.ml
<Directory "D:\Projects\new\yii-application">
AllowOverride All
</Directory>
</VirtualHost>
Step 5: Enable mod_rewrite on apache\apache2.4.9\conf\httpd.conf
No comments:
Post a Comment