Updating app from cake 2 to cake 3


#1

Hello,
I have a application built with Cake 2. Now I updated it to use Cake 3.

The problem I have is the url. In the old app I had url like this: /products/page:2/color:white+black/gender:female.
In the updated version the url changed, is like this:
/products?page=2&color=white+black&gender=female

I want to keep the same url format as in version 2 (for seo reason). How can I achieve this with Cake 3?


#2

I’m not a core developer but as far as i know your only option is to implement your own PaginatorComponent and PaginatorHelper.


#3

CakePHP 3 only uses query parameters for routing and it’s not possible to use the old format.


#4

The named variables have been deprecated because they were solving a problem that did not exist and caused serious SEO issues. Your best option is write a custom RouteClass that will parse the url for named variables and turn them into query params that Cake3 expects.

EDIT

Here’s a route I made that turns the old named param urls from cakephp2 into query routes for cakephp3 consumption: https://bitbucket.org/snippets/riddlemd/b9x88