Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
systems:yii2:setup_and_configuration [2018/05/10 16:03] smayr [Basic Template] |
systems:yii2:setup_and_configuration [2020/05/20 16:22] (current) ajdavis [Upgrade Yii] |
||
---|---|---|---|
Line 121: | Line 121: | ||
</ | </ | ||
- | Rename '' | + | Yii2 expects Bower and NPM packages to be installed to vendor/bower and vendor/npm folders respectively. So, to use asset-packagist it's necessary to add aliases in web.php: |
<code php> | <code php> | ||
- | //... | + | $config = [ |
- | public function setVendorPath($path) | + | |
- | { | + | 'aliases' |
- | | + | ' |
- | Yii:: | + | ' |
- | | + | ], |
- | | + | ... |
- | } | + | ]; |
</ | </ | ||
== Initial Configuration == | == Initial Configuration == | ||
Line 385: | Line 386: | ||
# HTTPS redirect for pages users input sensitive data (eg. password) | # HTTPS redirect for pages users input sensitive data (eg. password) | ||
+ | # NOTE: Disable these in localhost or other server without HTTPS. | ||
# | # | ||
# | # | ||
Line 712: | Line 714: | ||
* Backend: http:// | * Backend: http:// | ||
- | == Rewrite Base URL / | + | == Rewrite Base URL (/basic/web or / |
References: | References: | ||
- | * [[http:// | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
Line 720: | Line 721: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
* [[http:// | * [[http:// | ||
* [[https:// | * [[https:// | ||
* [[http:// | * [[http:// | ||
+ | |||
=== Basic App === | === Basic App === | ||
Create '' | Create '' | ||
Line 742: | Line 745: | ||
RewriteCond %{REQUEST_FILENAME} !-f | RewriteCond %{REQUEST_FILENAME} !-f | ||
RewriteCond %{REQUEST_FILENAME} !-d | RewriteCond %{REQUEST_FILENAME} !-d | ||
- | RewriteRule . / | + | |
+ | RewriteRule . index.php | ||
</ | </ | ||
Line 753: | Line 757: | ||
# Deny accessing dot files | # Deny accessing dot files | ||
RewriteRule (^\.|/\.) - [F] | RewriteRule (^\.|/\.) - [F] | ||
- | |||
</ | </ | ||
Line 767: | Line 770: | ||
</ | </ | ||
- | Edit '' | + | Hide the '' |
<code php> | <code php> | ||
<?php | <?php | ||
Line 774: | Line 777: | ||
use \yii\web\Request; | use \yii\web\Request; | ||
- | // Use current location | + | // Set current location |
- | // The Rewrite | + | // Mod_Rewrite |
$baseUrl = str_replace('/ | $baseUrl = str_replace('/ | ||
return [ | return [ | ||
- | | + | |
- | | + | |
' | ' | ||
- | // Define request. Must have a baseUrl specified | ||
' | ' | ||
- | ' | + | |
+ | // Required if wanting to hide ' | ||
+ | | ||
+ | |||
+ | //... | ||
], | ], | ||
- | // Define | + | // Activate |
' | ' | ||
' | ' | ||
Line 795: | Line 800: | ||
], | ], | ||
- | ... | + | |
], | ], | ||
' | ' |