Hey Leaf, We've done a lot of rewriting with our sites and mainly with http://theeasyapi.com, and http://www.countycriminal.com. One thing that I have found is that you must always use the controller name in the URL even when you are rewriting which controller picks it up.
In your example I would use instead of /hp/12345 I would use /users/ 12345 ... try that and see if you get a valid result. Like I said I know it's not the best approach as you obviously want to have /hp/ = / homepage/ but sometimes there are just a few things that just don't work in cake for some reason. The other thing you COULD do is a custom modification in your .htaccess. Change your routes to look for /homepage/ but then in your .htaccess put a rewrite rule in there to convert /hp/ to / homepage/ so the URL at the top stays the same but it does pass in / homepage/ instead. Keeps the same look and feel but does break the "cakeified" mentality. It's up to you and check out http://theeasyapi.com you can see a live site where we rewrite URL's and do a lot of really interesting things with our routes file. Have a wonderful day, Chad On Jan 26, 5:43 am, leafchild <[email protected]> wrote: > circket, thank you for the replay. > > actually i set to 'id'=>'[0-9a-zA-Z]+' in the beginning but make it > simple since nothing was working for me. > > code below gives me a "Missing controller error" it say I don't have a > Hp Controller > ================================================= > Router::connect('/hp/:id/', array( > 'controller' => 'users', > 'action' => 'homepage', > ), array( > 'id'=>'[0-9a-zA-Z]', 'pass'=>'id' > )); > ================================================= > > then if i have this code then it bring to home page > ================================================= > Router::connect('/hp/:id/', array( > 'controller' => 'users', > 'action' => 'homepage', > ), array( > 'id'=>'[0-9a-zA-Z]+', 'pass'=>'id' > )); > ================================================= > > What am I missing? > > On Jan 25, 5:08 pm, cricket <[email protected]> wrote: > > > What does the error msg say? That UsersController is missing, or > > something else? > > > Are your usernames limited to lowercase letters only and no digits? > > > And you might want to pass the ID to your action: > > > Router::connect( > > '/hp/:id/', > > array('controller' => 'users', 'action' => 'homepage'), > > array('id'=>'[a-z]', 'pass' => 'id') > > ); > > > On Jan 25, 5:19 pm, leafchild <[email protected]> wrote: > > > > I'm tring to fix URL > > > >www.mysite.com/users/homepage/{user's login name} > > > ->www.mysite.com/{user's login name} > > > > but I couldn't figure it out so I'm tesing with this > > > firstwww.mysite.com/users/homepage/{user's login name} > > > ->www.mysite.com/hp/{user's login name} > > > > Router::connect('/hp/:id/', array( 'controller' => 'users', 'action' > > > => 'homepage', ), > > > array('id'=>'[a-z]', ) > > > ); > > > > then when I access, mysite.com/hp/{user's login name}, I'm getting a > > > missing controller error. > > > > What I'm I doing wrong? I was expected to see the page with this URL. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
