Last active
April 9, 2020 16:18
-
-
Save haifahrul/daf35f934eb62f0ea941fe699c79dde1 to your computer and use it in GitHub Desktop.
Yii2 Basic Web for Hosting - Add code below into your root projects
This file contains hidden or 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
<?php | |
file_put_contents('.htaccess', <<<END | |
<IfModule mod_rewrite.c> | |
Options +SymLinksIfOwnerMatch | |
RewriteEngine On | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
RewriteCond %{REQUEST_URI} ^/.* | |
RewriteRule ^(.*)$ web/$1 [L] | |
RewriteCond %{REQUEST_URI} !^/web/ | |
RewriteCond %{REQUEST_FILENAME} !-f [OR] | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^.*$ web/index.php | |
</IfModule> | |
END | |
); | |
if (!is_dir('web')){ | |
mkdir('web'); | |
} | |
file_put_contents('web/.htaccess', <<<END | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . index.php | |
END | |
); | |
unlink(__FILE__); | |
header("Location: " . "http://" . $_SERVER['HTTP_HOST']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment