# Shopware in Unterordner

**URL:** <https://forum.shopware.com/t/shopware-in-unterordner/99987>\
**Category:** Shopware 6 (German)\
**Created:** [6. Juni 2023 um 12:31 UTC](https://forum.shopware.com/t/shopware-in-unterordner/99987 "2023-06-06T12:31:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![goldenerzirkel](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/goldenerzirkel/32/10567_2.png) [@goldenerzirkel](https://forum.shopware.com/u/goldenerzirkel)\
**Post date:** [6. Juni 2023 um 12:31 UTC](https://forum.shopware.com/t/shopware-in-unterordner/99987/1 "2023-06-06T12:31:03Z")

</div>

Hallo zusammen,  
ich versuche gerade den Shop neben mehreren anderen Systemen des Unternehmen unter dem Ordner `/shop` auszugeben.  
Es geht **nicht** um eine Testinstallation.

Wenn ich den Ordner in den Verkaufskanälen angebe, funktionieren die Artikel und Kategorie-URLs schon mal. Allerdings nicht die CSS/JS/Images Daten etc.  
Hat jemand eine Idee, wie ich diese Pfade auch noch anpassen kann?

Bereits erfolglos getestet:

- RewriteBase in HTACCESS
- Workaround [GitHub - hlohaus/shopware-subdir-project](https://github.com/hlohaus/shopware-subdir-project)
- Symlink (Test läuft noch)

Danke vorab für eure Tipps.  
Frohes Schaffen und Grüße, Kai

---

<div class="post-metadata">

**Author:** ![goldenerzirkel](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/goldenerzirkel/32/10567_2.png) [@goldenerzirkel](https://forum.shopware.com/u/goldenerzirkel)\
**Post date:** [7. Juni 2023 um 08:58 UTC](https://forum.shopware.com/t/shopware-in-unterordner/99987/2 "2023-06-07T08:58:51Z")

</div>

Wir haben die index.php von HLOHAUS’ GitHub Projekt auf SW6.5 angepasst, so geht es nun:

```auto
<?php declare(strict_types=1);

use Shopware\Core\HttpKernel;
use Shopware\Core\Installer\InstallerKernel;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\TerminableInterface;

$_SERVER['SCRIPT_FILENAME'] = __FILE__ ;

require_once __DIR__. '/../../vendor/autoload_runtime.php'; // FIXED PATH

if (!file_exists( __DIR__. '/../../.env')) { // FIXED PATH
    $_SERVER['APP_RUNTIME_OPTIONS']['disable_dotenv'] = true;
}

return function (array $context) {
    $classLoader = require __DIR__. '/../../vendor/autoload.php'; // FIXED PATH

    if (!file_exists(dirname( __DIR__ ) . '/../install.lock')) { // FIXED PATH
        $baseURL = str_replace(basename( __FILE__ ), '', $_SERVER['SCRIPT_NAME']);
        $baseURL = rtrim($baseURL, '/');

        if (strpos($_SERVER['REQUEST_URI'], '/installer') === false) {
            header('Location: ' . $baseURL . '/installer');
            exit;
        }
    }

    $appEnv = $context['APP_ENV'] ?? 'dev';
    $debug = (bool) ($context['APP_DEBUG'] ?? ($appEnv !== 'prod'));

    $trustedProxies = $context['TRUSTED_PROXIES'] ?? false;
    if ($trustedProxies) {
        Request::setTrustedProxies(
            explode(',', $trustedProxies),
            Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO
        );
    }

    $trustedHosts = $context['TRUSTED_HOSTS'] ?? false;
    if ($trustedHosts) {
        Request::setTrustedHosts(explode(',', $trustedHosts));
    }

    if (!file_exists(dirname( __DIR__ ) . '/../install.lock')) { // FIXED PATH
        return new InstallerKernel($appEnv, $debug);
    }

    $shopwareHttpKernel = new HttpKernel($appEnv, $debug, $classLoader);

    return new class($shopwareHttpKernel) implements HttpKernelInterface, TerminableInterface {
        private HttpKernel $httpKernel;

        public function __construct(HttpKernel $httpKernel)
        {
            $this->httpKernel = $httpKernel;
        }

        public function handle(Request $request, int $type = self::MAIN_REQUEST, bool $catch = true): Response
        {
            return $this->httpKernel->handle($request, $type, $catch)->getResponse();
        }

        public function terminate(Request $request, Response $response): void
        {
            $this->httpKernel->terminate($request, $response);
        }
    };
};

```
