Remove "/shop"

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
ritesh
Posts: 5
Joined: 29 Sep 2021, 10:41

Remove "/shop"

Post by ritesh » 25 Feb 2022, 11:02

Hi,
I want to remove the "/shop" path from the routes "/{site}/shop" and make it just "/{site}"; which works perfectly if I remove it from routes in shop config. But I also have other pages for example: "/about-us" which throws an exception -- about-us is being taken as site-code.

Code: Select all

No item found for conditions: Array ( [locale.site.code] => about-us )
Here's my route array on shop config

Code: Select all

'routes' => [
     'jsonapi' => ['prefix' => '{site}/jsonapi', 'middleware' => ['web', 'api']],
     'account' => ['prefix' => '{site}/profile', 'middleware' => ['web', 'auth']],
     'default' => ['prefix' => '{site}', 'middleware' => ['web']],
],
What am I missing here? I have tried statically configuring the default prefix, overwriting the aimeos shop routes and the both solution has it's flaws and errors.
_______
Laravel 8 with Aimeos 2021.10 + Marketplace. Setup via composer. Mac with Valet and MySql 8.0.25

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Remove "/shop"

Post by aimeos » 26 Feb 2022, 07:56

The Laravel routes which matches "/about-us" must be before the route for "/{site}". If "/about-us" should be matched dynamically by "/{page}", then it's impossible to define a routing that will work.

One option is to use a subdomain or custom domain for "{site}" so "{page}" can match all non-matched URLs at the end.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

ritesh
Posts: 5
Joined: 29 Sep 2021, 10:41

Re: Remove "/shop"

Post by ritesh » 28 Feb 2022, 11:15

"/about-us" is basically a static page with a custom route that is already on the top of the routes on routes/web.php file. Or am I missing something?

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Remove "/shop"

Post by aimeos » 01 Mar 2022, 09:07

Laravel doesn't support ordering routes very well and the only way to be sure that the correct route is used is to make it the only one matching that URL.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply