Created
April 9, 2020 15:41
-
-
Save haifahrul/cbbf7a6c08394bbcc7151795b5fd8291 to your computer and use it in GitHub Desktop.
Yii2 Basic Web for Hosting
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