Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
systems:yii2:setup_and_configuration [2018/05/18 16:59]
smayr [Rewrite Base URL /frontend/web]
systems:yii2:setup_and_configuration [2020/05/20 16:22] (current)
ajdavis [Upgrade Yii]
Line 121: Line 121:
 </code> </code>
  
-Rename ''bower'' references to ''bower-asset''.  In ''@app\vendor\yiisoft\yii2\base\Application.php'':+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=[ 
-    $this->_vendorPath = Yii::getAlias($path); +        '@bower' => '@vendor/bower-asset', 
-    Yii::setAlias('@vendor', $this->_vendorPath); +        '@npm'   => '@vendor/npm-asset'
-    Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower-asset');  // rename bower to bower-asset +    ], 
-    Yii::setAlias('@npm', $this->_vendorPath . DIRECTORY_SEPARATOR . 'npm'); +    ... 
-}+];
 </code> </code>
 == 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.
 #RewriteCond %{HTTPS} off #RewriteCond %{HTTPS} off
 #RewriteCond %{REQUEST_URI} /(login) [NC] #RewriteCond %{REQUEST_URI} /(login) [NC]
Line 712: Line 714:
   * Backend: http://admin.example.com    * Backend: http://admin.example.com 
  
-== Rewrite Base URL /frontend/web ==+== Rewrite Base URL (/basic/web or /frontend/web==
 References:  References: 
   * [[http://mrcoles.com/blog/simple-way-understand-mod-rewrite/|Simple mod_rewrite]]   * [[http://mrcoles.com/blog/simple-way-understand-mod-rewrite/|Simple mod_rewrite]]
Line 780: Line 782:
    
 return [ return [
-    'id' => 'app-frontend', 
     //...     //...
    
Line 791: Line 792:
             //...             //...
         ],         ],
-        // Define urlManager. Must have baseUrl specified.+        // Activate urlManager. Must have baseUrl specified.
         'urlManager' => [         'urlManager' => [
             'baseUrl'         => $baseUrl,             'baseUrl'         => $baseUrl,