1

In Cakephp 1 the first page of pagination also put page:1 in the url, how do I get CakePHP 2 to also do that? I know I read it somewhere, but I can't seem to find that page with a solution.

I know it was a visual/design solution from CakePHP self, but I need that page:1 part.

I hope someone can help me...

3
  • 1
    this is working very well in cakephp2.x. I assume the reason you think is not working because the first time loading page:1 is inactive. but if you click in other pages and click in page:1 you see it works well :)
    – Fury
    Feb 17, 2014 at 15:58
  • You should always mention the exact cakephp version you are using.
    – mark
    Feb 17, 2014 at 17:32
  • I'm sorry, I will add my CakePHP version in my future questions.
    – Femke
    Feb 19, 2014 at 7:25

1 Answer 1

0

We removed the page:1 part in CakePHP2.4 as it served no real purpose and made it SEO-invalid (both / and /page:1 accessed the same page). See the migration guide

My tip: 301 redirect (via htaccess or some custom component) the old to the new URL. Than

  • you wont need it
  • it's all SEO friendly (no juice lost)
  • it's future proof

Simple CakePHP implementation could be:

  • if named param action page == 1
  • then redirect(new url, 301) with new url = old url without named param page
2
  • Thanks for the answer! I will try to get this to work. For now I will use 472084's answer, because it's an Ajax Pagination and his answer works. But we still have to look into making it as SEO friendly as we can, so I will definitely try out what you suggested!
    – Femke
    Feb 19, 2014 at 7:24
  • Since CakePHP 2.0+ it is also highly recommended to not use named params anymore, but query strings, see dereuromark.de/2013/05/04/passed-named-or-query-string-params
    – mark
    Jan 9, 2017 at 14:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.