# Controller Route und Kategorie-Name identisch

**URL:** https://forum.shopware.com/t/controller-route-und-kategorie-name-identisch/106571
**Category:** Shopware 6 (German)
**Created:** [24. Februar 2025 um 14:35 UTC](https://forum.shopware.com/t/controller-route-und-kategorie-name-identisch/106571 "2025-02-24T14:35:34Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)
#### Post date: [24. Februar 2025 um 14:35 UTC](https://forum.shopware.com/t/controller-route-und-kategorie-name-identisch/106571/1 "2025-02-24T14:35:34Z")

</div>

Im Backend habe ich in Kategorie eine mit „externer Link“ auf /styling angelegt und inaktiv.

Dann habe ich meine Theme mit Controller weiter entwickelt, mit einer Route auf /styling

```auto
#[Route(path: '/styling', name: 'frontend.styling.default', defaults: ['_locale' => 'de'])]

```

Das funktionierte auch, bis ich die Kategorie aktiviert habe.

Jetzt erscheint aber weder meine route mit dem eigenen Template (404), noch erscheint im Hauptmenü die angelegt Kategorie.

Wie geht man hier vor?

Danke und Gruss

---

<div class="post-metadata">

### Author: ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)
#### Post date: [24. Februar 2025 um 14:50 UTC](https://forum.shopware.com/t/controller-route-und-kategorie-name-identisch/106571/2 "2025-02-24T14:50:34Z")

</div>

Auf gut Glück geraten: gebe der Kategorie eine neue SEO-URL und lösche die „alte“ SEO-URL-Weiterleitung aus der Datenbank.

@R4M hat vollkommen Recht, habe das „externe URL“ überlesen. Da sollte nichts angelegt werden. Kann dennoch sein, dass du die Kategorie vorher mal hattest und die URL dadurch in den SEO-Urls gelandet ist.

Ansonsten SEO-URL-Index neu aufbauen und Cache leeren.

---

<div class="post-metadata">

### Author: ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)
#### Post date: [24. Februar 2025 um 14:52 UTC](https://forum.shopware.com/t/controller-route-und-kategorie-name-identisch/106571/3 "2025-02-24T14:52:52Z")

</div>

Möglich das ich falsch liege, aber hier sollte in der Tabelle „seo\_url“ keine URL mit „/styling“ enthalten sein.

---

<div class="post-metadata">

### Author: ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)
#### Post date: [26. Februar 2025 um 08:30 UTC](https://forum.shopware.com/t/controller-route-und-kategorie-name-identisch/106571/4 "2025-02-26T08:30:45Z")

</div>

Danke für die Hilfe, für die URL mit /styling funktioniert es

Leider funktioniert das nicht für die anderen Routes, aber erst seit kurzem.

Der Sprachwechsler wenn man sich direkt auf der /styling oder /en/styling Seite befindet macht:

- /fr/styling?\_locale=fr-FR - Seite lädt
- /it/styling ?\_locale=it-IT - Seite lädt

Wenn man jedoch den richtigen Link in der Navigation klickt, dann kommt:

- /fr/stilisme - 404
- /fr/stilo - 404

Im Controller wurde das so geregelt:

```auto
    #[Route(path: '/styling', name: 'frontend.styling.default', defaults: ['_locale' => 'de'])]

    // Routen für andere Sprachen mit Präfix
    #[Route(path: '/fr/stylisme', name: 'frontend.styling.fr', defaults: ['_locale' => 'fr'])]
    #[Route(path: '/it/stilo', name: 'frontend.styling.it', defaults: ['_locale' => 'it'])]
    #[Route(path: '/en/styling', name: 'frontend.styling.en', defaults: ['_locale' => 'en'])]

```

In der DB seo\_urls gibt es keine Einträge zu stylisme, stilo oder styling

Hat jemand eine idee?

hier noch der ganze Controller:

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

namespace SwagBasicExampleTheme\Storefront\Controller;

use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
use Shopware\Core\Framework\Uuid\Uuid;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Shopware\Storefront\Controller\StorefrontController;
use SwagBasicExampleTheme\Storefront\Page\Example\ExamplePageLoader;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

#[Route(defaults: ['_routeScope' => ['storefront']])]
class StylingController extends StorefrontController
{
    private string $allowedSalesChannelId;
    private Connection $connection;
    private ExamplePageLoader $examplePageLoader;

    public function __construct(
        string $allowedSalesChannelId,
        Connection $connection,
        ExamplePageLoader $examplePageLoader
    ) {
        $this->allowedSalesChannelId = $allowedSalesChannelId;
        $this->connection = $connection;
        $this->ExamplePageLoader = $examplePageLoader;
    }
    // Route für Deutsch (ohne Sprachpräfix)
    #[Route(path: '/styling', name: 'frontend.styling.default', defaults: ['_locale' => 'de'])]

    // Routen für andere Sprachen mit Präfix
    #[Route(path: '/fr/stylisme', name: 'frontend.styling.fr', defaults: ['_locale' => 'fr'])]
    #[Route(path: '/it/stilo', name: 'frontend.styling.it', defaults: ['_locale' => 'it'])]
    #[Route(path: '/en/styling', name: 'frontend.styling.en', defaults: ['_locale' => 'en'])]
    public function showStyling(Request $request, SalesChannelContext $context): Response
    {
        $page = $this->ExamplePageLoader->load($request, $context);

        $languageId = $context->getLanguageId();

        $sql = "SELECT....";

        $styling = $this->connection->fetchAllAssociative($sql);

        return $this->renderStorefront('@SwagBasicExampleTheme/storefront/page/styling/styling.html.twig', [
            'styling' => $styling,
            'page' => $page
        ]);
    }
}

```

Danke und Gruss

---

<div class="post-metadata">

### Author: ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)
#### Post date: [26. Februar 2025 um 09:03 UTC](https://forum.shopware.com/t/controller-route-und-kategorie-name-identisch/106571/5 "2025-02-26T09:03:30Z")

</div>

![image](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/4/e/4e49cd51308323612e36c57efc566958fc2dd52e.png)  
Hier noch die Kategorie. z.b. Französisch

---

<div class="post-metadata">

### Author: ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)
#### Post date: [26. Februar 2025 um 09:10 UTC](https://forum.shopware.com/t/controller-route-und-kategorie-name-identisch/106571/6 "2025-02-26T09:10:10Z")

</div>

Sieht hier etwas anders aus: [Routing (Symfony Docs)](https://symfony.com/doc/current/routing.html#localized-routes-i18n)

---

<div class="post-metadata">

### Author: ![brettvormkopp](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/brettvormkopp/32/7788_2.png) [@brettvormkopp](https://forum.shopware.com/u/brettvormkopp)
#### Post date: [26. Februar 2025 um 09:14 UTC](https://forum.shopware.com/t/controller-route-und-kategorie-name-identisch/106571/7 "2025-02-26T09:14:21Z")

</div>

Danke für den Link, werde ich mir anschauen. Sieht aber irgendwie identisch aus, bis auf dass es als array zusammengefasst ist. aber ich schaue mal rein.

---

<div class="post-metadata">

### Author: ![system](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/2/9/29c7587ba660f00e4995d1743162782e5d6d8653.svg) [@system](https://forum.shopware.com/u/system)
#### Post date: [28. März 2025 um 09:15 UTC](https://forum.shopware.com/t/controller-route-und-kategorie-name-identisch/106571/8 "2025-03-28T09:15:12Z")

</div>

Dieses Thema wurde automatisch 30 Tage nach der letzten Antwort geschlossen. Es sind keine neuen Antworten mehr erlaubt.
