开发者

url rewrite not working in cakephp

开发者 https://www.devze.com 2023-01-03 20:32 出处:网络
I am working in cakephp.i have done rewrite url for all forms and links. and i have done server side validation through model.

I am working in cakephp.i have done rewrite url for all forms and links. and i have done server side validation through model. but when server side error is generate then url rewrite not working

one form i have done urlrewrite for that like

Router::connect('/employers/edit-securitydetail/:id', array(
    'controller' => 'fj_employers',
    'action'     => 'editSecurityDetail',
    'id'         => '[0-9]+'
));

then i can access this controller using this url employers/edit-securitydetail/1

when server side error is generate then url change to fj_employers/edi开发者_如何学GotSecurityDetail/1

can anyone help me


Use below:

Router::connect('/fj_employers/editSecurityDetail/:id', array(
    'controller' => 'fj_employers',
    'action'     => 'editSecurityDetail'),
    array('id' => '[0-9]*')
);

This will fix the problem. Actually the problem is in url rewriting correctly.


Try putting a second route in that looks like this:

Router::connect('/employers/editSecurityDetail/:id', array(
    'controller' => 'fj_employers',
    'action'     => 'editSecurityDetail',
    'id'         => '[0-9]+'
));

or maybe this:

Router::connect('/fj_employers/editSecurityDetail/:id', array(
    'controller' => 'fj_employers',
    'action'     => 'editSecurityDetail',
    'id'         => '[0-9]+'
));
0

精彩评论

暂无评论...
验证码 换一张
取 消