# Routing in cakephp 3.4

**URL:** <https://discourse.cakephp.org/t/routing-in-cakephp-3-4/3005>\
**Category:** Uncategorized\
**Created:** [August 9, 2017, 8:55pm UTC](https://discourse.cakephp.org/t/routing-in-cakephp-3-4/3005 "2017-08-09T20:55:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yomi](https://avatars.discourse-cdn.com/v4/letter/y/96bed5/32.png) [@Yomi](https://discourse.cakephp.org/u/Yomi)\
**Post date:** [August 9, 2017, 8:55pm UTC](https://discourse.cakephp.org/t/routing-in-cakephp-3-4/3005/1 "2017-08-09T20:55:48Z")

</div>

hello guys i have a serious challenge here any any help would definately save my job. I encourage my boss to migrate to cake 3.4 from 2.X version. after a long discussion, he agreed. And I start working on it… All went well with the migration until routing stage. In version 2.4, to improve our SEO, we uses something like this in the routes.php  
9:41  
Router::parseExtensions();  
Router::connect(  
’/schools/show/:school\_name’,  
array(‘controller’ =\> ‘schools’, ‘action’ =\> ‘show’),  
array(  
‘pass’ =\> array(‘school\_name’)  
)  
);  
9:42  
at the end we had this pattern [www.mywebsite.com/schools/show/80/school\_name:honeyland\_college%2C\_lagos.school](http://www.mywebsite.com/schools/show/80/school_name:honeyland_college%2C_lagos.school)  
9:43  
and all went well. To achieve the same this in cakephp 3,4 is a huge challenge to me. Now all links we have built over time with the above code in search engine takes users to error 404  
9:44  
how can i achieve the same pattern in cakephp 3  
9:44  
?

---

<div class="post-metadata">

**Author:** ![Yomi](https://avatars.discourse-cdn.com/v4/letter/y/96bed5/32.png) [@Yomi](https://discourse.cakephp.org/u/Yomi)\
**Post date:** [August 9, 2017, 9:19pm UTC](https://discourse.cakephp.org/t/routing-in-cakephp-3-4/3005/2 "2017-08-09T21:19:23Z")

</div>

this is my view.ctp \<?php echo $this-\>Html-\>link($school-\>name,

array(

```
   'controller' => 'schools',

   'action' => 'show', $school->id,

   'school_name' => strtolower(preg_replace('/\s+/', '_', $school->'name)),

   'ext' => 'school'

  )

);

 ?>
```

---

<div class="post-metadata">

**Author:** ![syed](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@syed](https://discourse.cakephp.org/u/syed)\
**Post date:** [August 10, 2017, 4:08am UTC](https://discourse.cakephp.org/t/routing-in-cakephp-3-4/3005/3 "2017-08-10T04:08:37Z")

</div>

I have no specific answer to your problem but, this is how the routing works in 3.x

> /\*\*  
> \* …and connect the rest of ‘Pages’ controller’s URLs.  
> _/  
> $routes-\>connect('/pages/_', [‘controller’ =\> ‘Pages’, ‘action’ =\> ‘display’]);
> 
> ```
> /**
> * Connect catchall routes for all controllers.
> *
> * Using the argument `DashedRoute`, the `fallbacks` method is a shortcut for
> * `$routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'DashedRoute']);`
> * `$routes->connect('/:controller/:action/*', [], ['routeClass' => 'DashedRoute']);`
> *
> * Any route class can be used with this method, such as:
> * - DashedRoute
> * - InflectedRoute
> * - Route
> * - Or your own route class
> *
> * You can remove these routes once you've connected the
> * routes you want in your application.
> */
> 
> ```

for more detail: [Routing - 3.10](https://book.cakephp.org/3.0/en/development/routing.html)
