I successfuly created redirecting in my routing, if page is 1, redirect to main controller without URL parameter page. (SEO prevention for dublicate content). So I have this route rules:
default_blog:
path: /
defaults: { _controller: AcmeBlogBundle:Default:index, page: 1}
default_blog_page_first:
path: /page/1
defaults:
_controller: FrameworkBundle:Redirect:redirect
route: default_blog
permanent: true
default_blog_page:
path: /page/{page}
defaults: { _controller: AcmeBlogBundle:Default:index}
requirements:
page: \d+
It works, in my pagination. If i click on my first page (/page/1) i will be redirected on /, but is it possible that it will already transformed in generating path? Just, if default_blog_page
will have parameter page = 1
it will automatically transformed to default_blog
?
So, my pagination will looks like this:
URL => Page
-------------------
/ => 1 , /page/2 => 2
In any twig template:
path('default_blog_page', {'page': 1})
if detects page = 1, it will automatically changed to:
path('default_blog')
Is it possible?