Friday, January 3, 2014

Re: Routing problem with "/*" url

Hi Stephen,

s members a prefix, or do you have a users method with login parameter, or do you have that as a custom route?
Yes, members is a prefix but the problem also exists with urls without prefix like /pages/display/about

I found a post on Mark Story's blog that is talking about my problem but it was for CakePHP 1.3 how can I use it with CakePHP 2?

http://mark-story.com/posts/view/using-custom-route-classes-in-cakephp

Thanks

On Friday, January 3, 2014 9:16:58 PM UTC+2, Stephen S wrote:
A few things come to my mind off the top off my head.

You could route your controller-action url's first, to catch the actual links such as /members/users/login (is members a prefix, or do you have a users method with login parameter, or do you have that as a custom route?)

Then providing you did those routes correctly, the bottom route would catch anything that didn't match the earlier ones, hopefully your post slug.

Another idea would be to use a regular expression to match the pattern of a "post-slug", if there are any distinguishing features this would be much more effective. If not I would recommend doing something like this:

/posts/post-slug
/blog/post-slug
/keyword/post-slug (i.e. if I was writing on a health care blog, I would use /health/post-slug. This could produce something like /health/top-10-diet-tips which holds the keyword health as well as the slug.)

It would be easier to avoid issues if you did it this way.

HTH

--
Kind Regards
 Stephen Speakman

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: