Microweber\Install\WebserverInstaller::setupApache PHP Method

setupApache() public method

public setupApache ( )
    public function setupApache()
    {
        $forbidDirs = ['app', 'bootstrap', 'config', 'database', 'resources', 'src', 'storage', 'tests', 'vendor'];
        if (function_exists('base_path')) {
            $rwBase = base_path();
        } elseif (isset($_SERVER['SCRIPT_NAME'])) {
            $rwBase = dirname($_SERVER['SCRIPT_NAME']);
        } elseif (isset($_SERVER['PHP_SELF'])) {
            $rwBase = dirname($_SERVER['PHP_SELF']);
        }
        $data = '
        <IfModule mod_rewrite.c>
            <IfModule mod_negotiation.c>
                Options -MultiViews
            </IfModule>
            RewriteEngine On
                # RewriteRule ^(.*)/$ ' . $rwBase . '/$1 [R=301,L]
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule ^(.*)$ index.php [NC,L]
        </IfModule>
        ';
        foreach ($forbidDirs as $dir) {
            $root = base_path() . DS;
            if (is_dir($root . $dir)) {
                $writable_path = $dir . DS . '.htaccess';
                if (!is_file($writable_path) and is_writable($writable_path)) {
                    $this->storeConfig($writable_path, 'Deny from all');
                }
            }
        }
        $is_htaccess = public_path() . DS . '.htaccess';
        if (!is_file($is_htaccess) and is_writable($is_htaccess)) {
            return $this->storeConfig('.htaccess', $data);
        }
    }