seo url routing problem. please help me
- hsynucak
- Member | 8
hi;
how my url seo friendly?
this default routing url:
<lang (tr|en)/>]<presenter>[/<action>][/<id>]
output: site.com/en/article/list/5
but id=5 name adding url
sample:
id=5 , name = samsung-note-phone
output: site.com/samsung-note-phone
or
output: site.com/en/samsung-note-phone
please help me
Last edited by hsynucak (2018-12-29 22:47)
- dkorpar
- Member | 135
In such cases I ussually create new class which implements
Nette\Application\IRouter interface and implement functionality on my own.
See more here: https://doc.nette.org/…tion/routing#…
- Milo
- Nette Core | 1283
@hsynucak The first route win, you can define more specific routes. Like:
$router = new RouteList;
# For articles reading
$router[] = new Route('[<lang (tr|en)>/]article[/<action>[/<id>]]', [
'presenter' => 'Article',
'action' => 'default',
]);
# Everything else
$router[] = new Route('[<lang (tr|en)>/]<name>', [
'presenter' => 'Product',
'action' => 'default',
]);
- hsynucak
- Member | 8
Milo wrote:
@hsynucak The first route win, you can define more specific routes. Like:
$router = new RouteList; # For articles reading $router[] = new Route('[<lang (tr|en)>/]article[/<action>[/<id>]]', [ 'presenter' => 'Article', 'action' => 'default', ]); # Everything else $router[] = new Route('[<lang (tr|en)>/]<name>', [ 'presenter' => 'Product', 'action' => 'default', ]);
thank you for your support but only firt presenter work. but other presenters not working.
sample :
$router[] = new Route('[<lang (tr|en)>/]<name>', [
'presenter' => 'Product',
'action' => 'default',
]);
$router[] = new Route('[<lang (tr|en)>/]<name>', [
'presenter' => 'Blog',
'action' => 'default',
]);
product presenter name working but blog name opened product page :(
Last edited by hsynucak (2019-01-16 16:43)
- hsynucak
- Member | 8
dkorpar wrote:
In such cases I ussually create new class which implements Nette\Application\IRouter interface and implement functionality on my own.
See more here: https://doc.nette.org/…tion/routing#…
please share sample code. and MyRouter class how add directory and use
thank you for your support