HMVC custom 404 pages - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: HMVC custom 404 pages (/showthread.php?tid=20600) Pages:
1
2
|
HMVC custom 404 pages - El Forum - 07-15-2009 [eluser]Mikle[/eluser] Hello! I'm using ME HMVC. How can I make custom 404 pages on it, if module or method of controller doesn't exist? HMVC custom 404 pages - El Forum - 07-15-2009 [eluser]karloff[/eluser] ter are a couple of diffent way however i like Jerome's solution http://maestric.com/doc/php/codeigniter_404 HMVC custom 404 pages - El Forum - 07-15-2009 [eluser]wiredesignz[/eluser] Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); HMVC custom 404 pages - El Forum - 07-16-2009 [eluser]Mikle[/eluser] I extended CI_Exeption class and added redirect to 404 controller in show_404() function. And for Google I added header("HTTP/1.1 404 Not Found"); and it's work perfect, and I can use now show_404() in any controller! HMVC custom 404 pages - El Forum - 07-16-2009 [eluser]wiredesignz[/eluser] You cannot 'redirect' to a different URL and then return the 404 header. You should return the 404 header from the invalid URL. HMVC custom 404 pages - El Forum - 07-16-2009 [eluser]Mikle[/eluser] [quote author="wiredesignz" date="1247762174"]You cannot 'redirect' to a different URL and then return the 404 header. You should return the 404 header from the invalid URL.[/quote] Why? My MY_Exceptions.php: Code: class MY_Exceptions extends CI_Exceptions And in error_404.php: Code: class Error_404 extends Controller { It works ok! HMVC custom 404 pages - El Forum - 08-12-2009 [eluser]CISCK[/eluser] I think wiredesignz means that for SEO reasons, it is recommended that you use use the initial invalid URL and its 404 header. You may be "confusing" search engines by changing the URL / redirecting to another page and then declaring a 404 error. That said, I'm not an SEO expert, so you may want to look into this further. HMVC custom 404 pages - El Forum - 08-12-2009 [eluser]kaola[/eluser] .htaccess ErrorDocument 404 /404.html HMVC custom 404 pages - El Forum - 08-12-2009 [eluser]Dan Horrigan[/eluser] Why go through all of this to show a 404 page when CI already does one? Simply modify the error_404.php file in the errors folder in the application folder. This is by far the easiest way to do it. HMVC custom 404 pages - El Forum - 08-12-2009 [eluser]Mikle[/eluser] My application has widgets and I use HMVC. I use main template with widgets and sitemap in content zone for 404 pages. |