Rails will_paginate routing caching duplicate pages -
I use the will_paginate plug-in
To generate routes I I can cache ( / posts / index / 2 instead of / posts? Page = 2 ) I added the following to my routes. RB:
map.connect '/ posts / index / 1' ,: controller = & gt; 'Redirect' ,: url = & gt; '/ Post /' map.connect 'post / index / page:' ,: admin = & gt; 'Post',: Action => 'Index',: requirements => {: Pg = & gt; / \ D + /} ,: Page = & gt; Zero To avoid a duplicate of the first line, use a redirect controller to / posts / index / 1 to / posts / Redirects page
Do I set up the 'Post / Index / Page Page' rule?
I thought : needs = & gt; {: Pg = & gt; / \ D + /} will ensure that / post / index / without : page parameter can not work, but / posts / index To avoid having both html caching
/ posts.html , I can convert / posts / index / to < How can I redirect code> / posts / and /posts/index.html ? thanks
UPDATE
I just added
map.connect '/ posts / index /' ,: Controller = & gt; 'Redirect' ,: url = & gt; '/ Posts'' and I can not find a duplicate page.
However, I still do not tell why I was getting /posts/index.html any clarification or suggestion of making this rule more concise is welcome; )!
map.connect '/ posts / index / 1' ,: admin = & gt; 'Redirect' ,: url = & gt; '/ Post /' map.connect '/ post / index /',: admin = & gt; 'Redirect' ,: url = & gt; '/ Post /' map.connect 'post / index / page:' ,: admin = & gt; 'Post',: Action => 'Index',: requirements => {: Pg = & gt; / \ D + /} ,: Page = & gt; Zero
I found the possible answer to your question.
I think the is adding: page = & gt; Zero can override the previous state. So it is possible that when you remove this part, it will work as you expect.
Comments
Post a Comment