Re: Sending a 404 header from the controller
On Fri, Jul 11, 2014 at 2:31 PM, Alex Bovey a...@bovey.co.uk wrote: Hello all, I would like one of my controller methods to be able to send a 404 Not Found header, but still render the view as normal. I've tried both of the following at the beginning of my controller method, but Cake is still returning a 200 OK header: $this-response-header('HTTP/1.1 404 Not Found'); $this-response-httpCodes(404); Solved. For anyone that finds this in future the function is $this-response-statusCode(404) not $this-response- httpCodes(404). Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England Wales no. 6471391 | VAT no. 934 8959 65 a...@bovey.co.uk | t 0844 567 8995 | m 07828 649386 | f 0870 288 9533 PHP | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- 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+unsubscr...@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/d/optout.
Re: Sending a 404 header from the controller
+1 for correcting it here as reference for future findings Am Montag, 14. Juli 2014 11:38:47 UTC+2 schrieb Alex Bovey: On Fri, Jul 11, 2014 at 2:31 PM, Alex Bovey al...@bovey.co.uk javascript: wrote: Hello all, I would like one of my controller methods to be able to send a 404 Not Found header, but still render the view as normal. I've tried both of the following at the beginning of my controller method, but Cake is still returning a 200 OK header: $this-response-header('HTTP/1.1 404 Not Found'); $this-response-httpCodes(404); Solved. For anyone that finds this in future the function is $this-response-statusCode(404) not $this-response- httpCodes(404). Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England Wales no. 6471391 | VAT no. 934 8959 65 al...@bovey.co.uk javascript: | t 0844 567 8995 | m 07828 649386 | f 0870 288 9533 PHP | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- 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+unsubscr...@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/d/optout.
Sending a 404 header from the controller
Hello all, I would like one of my controller methods to be able to send a 404 Not Found header, but still render the view as normal. I've tried both of the following at the beginning of my controller method, but Cake is still returning a 200 OK header: $this-response-header('HTTP/1.1 404 Not Found'); $this-response-httpCodes(404); Please note that I don't just want to do a custom 404 page - I still want to render the page using the current controller method. I am using Cake 2.4. Any help would be much appreciated. Thanks all, Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England Wales no. 6471391 | VAT no. 934 8959 65 a...@bovey.co.uk | t 0844 567 8995 | m 07828 649386 | f 0870 288 9533 PHP | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- 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+unsubscr...@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/d/optout.
Re: Sending a 404 header from the controller
You should see this http://pastebin.com/zNB6SFg7 2014-07-11 10:31 GMT-03:00 Alex Bovey a...@bovey.co.uk: Hello all, I would like one of my controller methods to be able to send a 404 Not Found header, but still render the view as normal. I've tried both of the following at the beginning of my controller method, but Cake is still returning a 200 OK header: $this-response-header('HTTP/1.1 404 Not Found'); $this-response-httpCodes(404); Please note that I don't just want to do a custom 404 page - I still want to render the page using the current controller method. I am using Cake 2.4. Any help would be much appreciated. Thanks all, Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England Wales no. 6471391 | VAT no. 934 8959 65 a...@bovey.co.uk | t 0844 567 8995 | m 07828 649386 | f 0870 288 9533 PHP | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- 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+unsubscr...@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/d/optout. -- http://leandrompereira.com.br ***Se você pretende redirecionar este e-mail, por favor, apague todos os endereços que aparecem nele. Outra dica de segurança é endereçá-lo no Cco. Desta forma você estará protegendo a mim, seus amigos e a você mesmo. Eu e a Campanha Contra o SPAM agradecemos.Não envie correntes.*** -- 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+unsubscr...@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/d/optout.
Re: Sending a 404 header from the controller
Thank you Leandro - I can't see where that outputs a 404 header though? Alex On Fri, Jul 11, 2014 at 3:09 PM, Leandro Machado Pereira llperei...@gmail.com wrote: You should see this http://pastebin.com/zNB6SFg7 2014-07-11 10:31 GMT-03:00 Alex Bovey a...@bovey.co.uk: Hello all, I would like one of my controller methods to be able to send a 404 Not Found header, but still render the view as normal. I've tried both of the following at the beginning of my controller method, but Cake is still returning a 200 OK header: $this-response-header('HTTP/1.1 404 Not Found'); $this-response-httpCodes(404); Please note that I don't just want to do a custom 404 page - I still want to render the page using the current controller method. I am using Cake 2.4. Any help would be much appreciated. Thanks all, Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England Wales no. 6471391 | VAT no. 934 8959 65 a...@bovey.co.uk | t 0844 567 8995 | m 07828 649386 | f 0870 288 9533 PHP | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- 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+unsubscr...@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/d/optout. -- http://leandrompereira.com.br ***Se você pretende redirecionar este e-mail, por favor, apague todos os endereços que aparecem nele. Outra dica de segurança é endereçá-lo no Cco. Desta forma você estará protegendo a mim, seus amigos e a você mesmo. Eu e a Campanha Contra o SPAM agradecemos.Não envie correntes.*** -- 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+unsubscr...@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/d/optout. -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England Wales no. 6471391 | VAT no. 934 8959 65 a...@bovey.co.uk | t 0844 567 8995 | m 07828 649386 | f 0870 288 9533 PHP | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- 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+unsubscr...@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/d/optout.
Re: 404 Header
O.K, i solved the issue, first i have to mention that this app is using CakePHP 1.1 and NOT 1.2 The issue that was causing all this headache was because there were some warnings that have been displayed while 2 lines of code being executed in app_controller, though debug level is 0 but still those warnings and notices being displayed and i really donno how or why, anyway, i have put the shut up = @ sign before those 2 lines of code and everything went like a charm but i do really suspect having a bug where debug level was 0 and still there were warnings and notices instead of having a clean server response. Thanks every body On Wed, Jul 22, 2009 at 10:36 PM, Ma'moon phpir...@gmail.com wrote: Yes, debug level has been set to 0 On Wed, Jul 22, 2009 at 9:35 PM, lapinski lapinski@gmail.com wrote: Did you turn debug mode off? Ma'moon Al-Akash wrote: Sure ... HTTP/1.1 302 Found Date: Tue, 21 Jul 2009 20:00:04 GMT Server: Apache X-Powered-By: PHP/5.2.6 Location: http://video.maktoob.com/?url=sfgsd Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform, max-age=0, must-revalidate Expires: Tue, 21 Jul 2009 20:00:04 GMT Vary: Accept-Encoding,User-Agent Content-Type: text/html Connection: Keep-Alive Set-Cookie: userCountry=JO; expires=Thu, 17-Dec-2020 19:00:04 GMT; path=/ Set-Cookie: MKTID_copy=deleted; expires=Mon, 21-Jul-2008 20:00:03 GMT; path=/; domain=video.maktoob.com On Tue, Jul 21, 2009 at 6:18 PM, Piotr Kilczuk kilc...@gmail.com wrote: Hello, i have a problem with my CakePHP app where the client needs me to return a valid 404 page together with a valid 404 http header incase of page not found, i have handled the 404 page through app_error but the problem is when i execute ( curl -I http://www.example.com/sdfsdfas ) on my debian box it keeps returning ( 302 Page Found ) instead of ( 404 Page Not Found) , anyone faced something like this, and if any, would you please explain how you solve it? Can you paste the complete response (all server headers)? Regards, Piotr -- http://phpirate.net -- View this message in context: http://www.nabble.com/404-Header-tp24587977p24612078.html Sent from the CakePHP mailing list archive at Nabble.com. -- http://phpirate.net -- http://phpirate.net --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 404 Header
Did you turn debug mode off? Ma'moon Al-Akash wrote: Sure ... HTTP/1.1 302 Found Date: Tue, 21 Jul 2009 20:00:04 GMT Server: Apache X-Powered-By: PHP/5.2.6 Location: http://video.maktoob.com/?url=sfgsd Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform, max-age=0, must-revalidate Expires: Tue, 21 Jul 2009 20:00:04 GMT Vary: Accept-Encoding,User-Agent Content-Type: text/html Connection: Keep-Alive Set-Cookie: userCountry=JO; expires=Thu, 17-Dec-2020 19:00:04 GMT; path=/ Set-Cookie: MKTID_copy=deleted; expires=Mon, 21-Jul-2008 20:00:03 GMT; path=/; domain=video.maktoob.com On Tue, Jul 21, 2009 at 6:18 PM, Piotr Kilczuk kilc...@gmail.com wrote: Hello, i have a problem with my CakePHP app where the client needs me to return a valid 404 page together with a valid 404 http header incase of page not found, i have handled the 404 page through app_error but the problem is when i execute ( curl -I http://www.example.com/sdfsdfas ) on my debian box it keeps returning ( 302 Page Found ) instead of ( 404 Page Not Found) , anyone faced something like this, and if any, would you please explain how you solve it? Can you paste the complete response (all server headers)? Regards, Piotr -- http://phpirate.net -- View this message in context: http://www.nabble.com/404-Header-tp24587977p24612078.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 404 Header
Yes, debug level has been set to 0 On Wed, Jul 22, 2009 at 9:35 PM, lapinski lapinski@gmail.com wrote: Did you turn debug mode off? Ma'moon Al-Akash wrote: Sure ... HTTP/1.1 302 Found Date: Tue, 21 Jul 2009 20:00:04 GMT Server: Apache X-Powered-By: PHP/5.2.6 Location: http://video.maktoob.com/?url=sfgsd Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform, max-age=0, must-revalidate Expires: Tue, 21 Jul 2009 20:00:04 GMT Vary: Accept-Encoding,User-Agent Content-Type: text/html Connection: Keep-Alive Set-Cookie: userCountry=JO; expires=Thu, 17-Dec-2020 19:00:04 GMT; path=/ Set-Cookie: MKTID_copy=deleted; expires=Mon, 21-Jul-2008 20:00:03 GMT; path=/; domain=video.maktoob.com On Tue, Jul 21, 2009 at 6:18 PM, Piotr Kilczuk kilc...@gmail.com wrote: Hello, i have a problem with my CakePHP app where the client needs me to return a valid 404 page together with a valid 404 http header incase of page not found, i have handled the 404 page through app_error but the problem is when i execute ( curl -I http://www.example.com/sdfsdfas ) on my debian box it keeps returning ( 302 Page Found ) instead of ( 404 Page Not Found) , anyone faced something like this, and if any, would you please explain how you solve it? Can you paste the complete response (all server headers)? Regards, Piotr -- http://phpirate.net -- View this message in context: http://www.nabble.com/404-Header-tp24587977p24612078.html Sent from the CakePHP mailing list archive at Nabble.com. -- http://phpirate.net --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
404 Header
Hello Guys, i have a problem with my CakePHP app where the client needs me to return a valid 404 page together with a valid 404 http header incase of page not found, i have handled the 404 page through app_error but the problem is when i execute ( curl -I http://www.example.com/sdfsdfas ) on my debian box it keeps returning ( 302 Page Found ) instead of ( 404 Page Not Found) , anyone faced something like this, and if any, would you please explain how you solve it? Thanks a lot. MHA -- http://phpirate.net --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 404 Header
Hello, i have a problem with my CakePHP app where the client needs me to return a valid 404 page together with a valid 404 http header incase of page not found, i have handled the 404 page through app_error but the problem is when i execute ( curl -I http://www.example.com/sdfsdfas ) on my debian box it keeps returning ( 302 Page Found ) instead of ( 404 Page Not Found) , anyone faced something like this, and if any, would you please explain how you solve it? Can you paste the complete response (all server headers)? Regards, Piotr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 404 Header
Sure ... HTTP/1.1 302 Found Date: Tue, 21 Jul 2009 20:00:04 GMT Server: Apache X-Powered-By: PHP/5.2.6 Location: http://video.maktoob.com/?url=sfgsd Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform, max-age=0, must-revalidate Expires: Tue, 21 Jul 2009 20:00:04 GMT Vary: Accept-Encoding,User-Agent Content-Type: text/html Connection: Keep-Alive Set-Cookie: userCountry=JO; expires=Thu, 17-Dec-2020 19:00:04 GMT; path=/ Set-Cookie: MKTID_copy=deleted; expires=Mon, 21-Jul-2008 20:00:03 GMT; path=/; domain=video.maktoob.com On Tue, Jul 21, 2009 at 6:18 PM, Piotr Kilczuk kilc...@gmail.com wrote: Hello, i have a problem with my CakePHP app where the client needs me to return a valid 404 page together with a valid 404 http header incase of page not found, i have handled the 404 page through app_error but the problem is when i execute ( curl -I http://www.example.com/sdfsdfas ) on my debian box it keeps returning ( 302 Page Found ) instead of ( 404 Page Not Found) , anyone faced something like this, and if any, would you please explain how you solve it? Can you paste the complete response (all server headers)? Regards, Piotr -- http://phpirate.net --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---