Logo Logo Flashsoft Flashsoft
  • Logo Flashsoft Beranda
  • Logo Flashsoft Blog
  • Logo Flashsoft Profil
  • Logo Flashsoft Kontak Kami
  • Logo Flashsoft Class Programming
  • Logo Flashsoft Produk


Bagus, Cepat dan Terjangkau
Kunjungi Instagram @flash_soft
Hubungi Whatsapp untuk kepentingan bisnis di 0812 612 3812
Jasa Website Bagus, Cepat dan Murah
Belajar buat web sendiri di Class Programming Flashsoft
Program Masjid Digital se-Pekanbaru dan Riau
Bagus, Cepat dan Terjangkau
Daftar Class Programming!!
  • Home
  • Blog
  • Cara Menghilangkan frontend/web Pada Yii2 Advance

Buka Toko Online Anda

Buka Toko Online Anda

Class Programming
Php
Web
Yii

Cara Menghilangkan frontend/web Pada Yii2 Advance

Jasa Website Murah Pekanbaru

By writer


Posted on January 1, 1970

Jasa Website Murah Pekanbaru
Cara menghilangkan frontend/web pada Yii2 advance dapat dilakukan dengan menggunakan .htaccess dan mengedit config pada Yii2. Istilah untuk menghilangkan frontent/web biasa juga dikenal dengan istilah pretty url atau friendly url.

Sebagai contoh, merubah http://flashsoftindonesia.com/frontend/web/site/index ke http://flashsoftindonesia.com/site/index

Kita akan membuatkan file .htaccess jika belum ada, dan meletakkan pada folder root. Dan membuat file .htaccess yang kedua pada folder frontend/web/.htaccess. Kemudian yang terakhir adalah menambahkan koding pada file /frontend/config/main.php untuk pengaturan baseUrl pada Yii2. Selengkapnya sebagai berikut :

1. Menambahkan file .htaccess pada folder root

- /

- + backend

- + frontend

- - - + config

- - - - - - main.php

- - - + controllers

- - - + models

- - - + views

- - - + web

- - - - - - .htaccess

- - .htaccess

Berikut source code /.htaccess # prevent directory listings Options -Indexes IndexIgnore */* # follow symbolic links Options FollowSymlinks RewriteEngine on RewriteRule ^administrator(/.+)?$ backend/web/$1 [L,PT] # RewriteRule ^(.+)?$ frontend/web/$1 RewriteRule ^(.*)$ frontend/web/$1 [L]

2. Menambahkan file .htaccess pada folder frontend/web

- /

- + backend

- + frontend

- - - + config

- - - - - - main.php

- - - + controllers

- - - + models

- - - + views

- - - + web

- - - - - - .htaccess

- - .htaccess

Berikut source code /frontend/web/.htaccess RewriteEngine on # If a directory or a file exists, use the request directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Otherwise forward the request to index.php RewriteRule . index.php

3. Menambahkan config pada file frontend/config/main.php

- /

- + backend

- + frontend

- - - + config

- - - - - - main.php

- - - + controllers

- - - + models

- - - + views

- - - + web

- - - - - - .htaccess

- - .htaccess

Berikut source code /frontend/config/main.php <?php $params = array_merge( require(__DIR__ . '/../../common/config/params.php'), require(__DIR__ . '/../../common/config/params-local.php'), require(__DIR__ . '/params.php'), require(__DIR__ . '/params-local.php') ); use \yii\web\Request; $baseUrl = str_replace('/frontend/web', '', (new Request)->getBaseUrl()); return [ 'id' => 'app-frontend', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'controllerNamespace' => 'frontend\controllers', 'components' => [ 'request' => [ 'baseUrl' => $baseUrl, ], 'user' => [ 'identityClass' => 'common\models\User', 'enableAutoLogin' => true, ], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], ], ], ], 'errorHandler' => [ 'errorAction' => 'site/error', ], 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ ], ], ], 'params' => $params, ];

Selesai mengikuti langkah diatas, silahkan dilakukan pengecekan pada web yang di buat. Seharusnya url http://flashsoftindonesia.com/frontend/web/site/index sudah menjadi http://flashsoftindonesia.com/site/index

Sekian dan Terima Kasih


Postingan Terkait

Jasa Website Murah Pekanbaru

Cara Download dan Install Yii Framework Offline

Jasa Website Murah Pekanbaru

Cara Menghilangkan frontend/web Pada Yii2 Advance

Jasa Website Murah Pekanbaru

Auto Complete Menggunakan Ajax di Framework Yii1

Jasa Website Murah Pekanbaru

Belajar Yii framework dari dasar

Kategori

  • Beda Warna
  • Bisnis Digital
  • Class Programming
  • Helowot
  • Php
  • Software House
  • Toko Online
  • UKM
  • Uncategory
  • Web
  • Yii

Buka Toko Online Anda

Buka Toko Online Anda

Class Programming
Php
Web
Yii

Cara Menghilangkan frontend/web Pada Yii2 Advance

Jasa Website Murah Pekanbaru

By writer


Posted on January 1, 1970

Jasa Website Murah Pekanbaru
Cara menghilangkan frontend/web pada Yii2 advance dapat dilakukan dengan menggunakan .htaccess dan mengedit config pada Yii2. Istilah untuk menghilangkan frontent/web biasa juga dikenal dengan istilah pretty url atau friendly url.

Sebagai contoh, merubah http://flashsoftindonesia.com/frontend/web/site/index ke http://flashsoftindonesia.com/site/index

Kita akan membuatkan file .htaccess jika belum ada, dan meletakkan pada folder root. Dan membuat file .htaccess yang kedua pada folder frontend/web/.htaccess. Kemudian yang terakhir adalah menambahkan koding pada file /frontend/config/main.php untuk pengaturan baseUrl pada Yii2. Selengkapnya sebagai berikut :

1. Menambahkan file .htaccess pada folder root

- /

- + backend

- + frontend

- - - + config

- - - - - - main.php

- - - + controllers

- - - + models

- - - + views

- - - + web

- - - - - - .htaccess

- - .htaccess

Berikut source code /.htaccess # prevent directory listings Options -Indexes IndexIgnore */* # follow symbolic links Options FollowSymlinks RewriteEngine on RewriteRule ^administrator(/.+)?$ backend/web/$1 [L,PT] # RewriteRule ^(.+)?$ frontend/web/$1 RewriteRule ^(.*)$ frontend/web/$1 [L]

2. Menambahkan file .htaccess pada folder frontend/web

- /

- + backend

- + frontend

- - - + config

- - - - - - main.php

- - - + controllers

- - - + models

- - - + views

- - - + web

- - - - - - .htaccess

- - .htaccess

Berikut source code /frontend/web/.htaccess RewriteEngine on # If a directory or a file exists, use the request directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Otherwise forward the request to index.php RewriteRule . index.php

3. Menambahkan config pada file frontend/config/main.php

- /

- + backend

- + frontend

- - - + config

- - - - - - main.php

- - - + controllers

- - - + models

- - - + views

- - - + web

- - - - - - .htaccess

- - .htaccess

Berikut source code /frontend/config/main.php <?php $params = array_merge( require(__DIR__ . '/../../common/config/params.php'), require(__DIR__ . '/../../common/config/params-local.php'), require(__DIR__ . '/params.php'), require(__DIR__ . '/params-local.php') ); use \yii\web\Request; $baseUrl = str_replace('/frontend/web', '', (new Request)->getBaseUrl()); return [ 'id' => 'app-frontend', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'controllerNamespace' => 'frontend\controllers', 'components' => [ 'request' => [ 'baseUrl' => $baseUrl, ], 'user' => [ 'identityClass' => 'common\models\User', 'enableAutoLogin' => true, ], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], ], ], ], 'errorHandler' => [ 'errorAction' => 'site/error', ], 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ ], ], ], 'params' => $params, ];

Selesai mengikuti langkah diatas, silahkan dilakukan pengecekan pada web yang di buat. Seharusnya url http://flashsoftindonesia.com/frontend/web/site/index sudah menjadi http://flashsoftindonesia.com/site/index

Sekian dan Terima Kasih


Postingan Terkait

Jasa Website Murah Pekanbaru

Cara Download dan Install Yii Framework Offline

Jasa Website Murah Pekanbaru

Cara Menghilangkan frontend/web Pada Yii2 Advance

Jasa Website Murah Pekanbaru

Auto Complete Menggunakan Ajax di Framework Yii1

Jasa Website Murah Pekanbaru

Belajar Yii framework dari dasar

Kategori

  • Beda Warna
  • Bisnis Digital
  • Class Programming
  • Helowot
  • Php
  • Software House
  • Toko Online
  • UKM
  • Uncategory
  • Web
  • Yii

© Flashsoft 2014-2021

Development by Flashsoft