Cakephp 3 SEO URLS

I would like to know how we will be able to write the routing condition is I have a category named “ABC” and subcategory “XYZ”. My url needs to be like

etc…

Kindly advice me

Have you read the chapter on routing? What things have you tried?

1 Like

Then make your route as needed:

$routes->connect('/ABC/XYZ', ['controller' => 'Whatever', 'action' => 'yourneataction']);

With routing, and sorry, I don’t understand the question.

Yes, I have written a Routeclass for category and there I have written match and parse functions. Also added the route class in routes.php

but the function match and parse are not overriding in the routeclass

ABC and XYZ is dynamic, I was just trying to give an example. I need to set routing for urls like this

example.com/categoryname
example.com/categoryname/subcategoryname

Don’t overcomplicate it.
You just want…

/category/subcategory, it is pretty straight forward as @jimgwhit suggested, you need to call connect from within your routes.php file.

What have you tried so far?

1 Like

P.S. When people say “what have you tried”, they don’t want a general description. They want to see the code that you wrote. In this case, the exact route definitions that you’ve used.