manager-bundle/src/Command/InstallWebDirCommand.php
private function addHtaccess(string $webDir): void
    {
        $htaccess = __DIR__.'/../Resources/skeleton/web/.htaccess';

        if (!file_exists($webDir.'/.htaccess')) {
            $this->fs->copy($htaccess, $webDir.'/.htaccess', true);
            $this->io->writeln('Added the <comment>web/.htaccess</comment> file.');

            return;
        }

        $existingContent = file_get_contents($webDir.'/.htaccess');

        // Return if there already is a rewrite rule
        if (preg_match('/^\s*RewriteRule\s/im', $existingContent)) {
            return;
        }

        $this->fs->dumpFile($webDir.'/.htaccess', $existingContent."\n\n".file_get_contents($htaccess));
        $this->io->writeln('Updated the <comment>web/.htaccess</comment> file.');
    }
private function addHtaccess(string $webDir): void
    {
        $htaccess = __DIR__.'/../Resources/skeleton/web/.htaccess';

        if (!file_exists($webDir.'/.htaccess')) {
            $this->fs->copy($htaccess, $webDir.'/.htaccess', true);
            $this->io->writeln('Added the <comment>web/.htaccess</comment> file.');

            return;
        }

        $existingContent = file_get_contents($webDir.'/.htaccess');

        // Return if there already is a rewrite rule
        if (preg_match('/^\s*RewriteRule\s/im', $existingContent)) {
            return;
        }

        $this->fs->dumpFile($webDir.'/.htaccess', $existingContent."\n\n".file_get_contents($htaccess));
        $this->io->writeln('Updated the <comment>web/.htaccess</comment> file.');
    }
Adds the .htaccess file or merges it with an existing one.