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

### <https://www.yiiframework.com/doc/guide/2.0/en>

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>
```

<figure><img src="https://3719231-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdT6R5JUtK4nkuVPPsdyR%2Fuploads%2F9TGgwEIIJwwQSjfAkGgU%2Fimage.png?alt=media&#x26;token=95c20604-cd9b-4dee-b09b-77785bf268eb" alt=""><figcaption></figcaption></figure>

## [Yii2 remove index.php from url](https://stackoverflow.com/questions/30583757/yii2-remove-index-php-from-url)

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>',
    ],
]
```
