-
-
Save RomeoDenis/f7d8bab05f377e6b94037b31b81352d5 to your computer and use it in GitHub Desktop.
Yii 2 Advanced Application Template on virtual hosting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Options -Indexes | |
<IfModule !mod_rewrite.c> | |
Deny from all | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteBase / | |
# no recursion | |
RewriteCond %{ENV:REDIRECT_STATUS} 200 | |
RewriteRule ^ - [L] | |
RewriteCond %{REQUEST_URI} ^/rearend(/.*|)$ | |
# no recursion if '/backend/' is used as backend alias | |
RewriteCond %{REQUEST_URI} !^/backend/web(/.*|)$ | |
RewriteRule ^rearend(/.*|)$ backend/web$1 [L] | |
RewriteCond %{REQUEST_URI} !^/backend/web(/.*|)$ | |
RewriteRule ^(.*)$ frontend/web/$1 [L] | |
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
'bootstrap' => [ | |
function () { | |
$path = '/rearend/'; | |
$filename = basename(Yii::$app->getRequest()->getScriptFile()); | |
Yii::$app->getRequest()->setScriptUrl($path . $filename); | |
Yii::$app->getRequest()->setBaseUrl(rtrim($path, '/')); | |
}, | |
'log', | |
// ... | |
], | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
'bootstrap' => [ | |
function () { | |
$path = '/'; | |
$filename = basename(Yii::$app->getRequest()->getScriptFile()); | |
Yii::$app->getRequest()->setScriptUrl($path . $filename); | |
Yii::$app->getRequest()->setBaseUrl(rtrim($path, '/')); | |
}, | |
'log', | |
// ... | |
], | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^. index.php | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment