I have one view file of TestController And on that I have added comment form (the url of page on which my page exist is www.example.com/test/view/slug)now comment form is posting on url www.example.com/comments/add action comment is adding successfully after addition I have written (in comment/add method)
$this->redirect($this->referer());
what I was expecting is it should redirect to www.example.com/test/view/slug . its redirecting on that url on my localhost but when I deployed my application it is redirecting not redirecting propery it is redirecting on url www.example.com/comment/www.example.com and giving error
Error: The requested address '/comments/www.example.com' was not found on this server.
Try this
$this->redirect( Router::url( $this->referer(), true ) );
This will use FULL urls in your redirect and this may fix your problem with adding your redirect to the current URL instead of just using it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With