Yii framework - Tìm hiểu cấu trúc và chạy thử với basic application (ok)

https://viblo.asia/p/yii-framework-tim-hieu-cau-truc-va-chay-thu-voi-basic-application-Qbq5QJOJKD8

C:\xampp81\htdocs\cmstest\web\.htaccess

RewriteEngine on
# hide files and folders
RedirectMatch 404 /_protected
RedirectMatch 404 /\.git
RedirectMatch 404 /composer\.
RedirectMatch 404 /.bowerrc
# If a directory or a file exists, use the request directly
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,NE,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . /index.php [L]

C:\xampp81\apache\conf\extra\httpd-vhosts.conf

<VirtualHost cmstest.com:443>
     DocumentRoot "C:\xampp81\htdocs\cmstest\web"
     ServerName cmstest.com
     ServerAlias *.cmstest.com
     SSLEngine on
     SSLCertificateFile "conf/cmstest/ssl.crt/server.crt"
     SSLCertificateKeyFile "conf/cmstest/ssl.key/server.key"
</VirtualHost>

C:\xampp81\htdocs\cmstest\config\web.php

'urlManager' => [
    'enablePrettyUrl' => true,
    'showScriptName' => false,
    'rules' => [
        '<controller:\w+>/<id:\d+>' => '<controller>/view',
        '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
        '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
    ],
]

Last updated

Was this helpful?