show 404 question |
Hi,
Just have a question about show404. If my <a href=""> is empty how can I make it go to page not found or error 404 on codeigniter? Currently if link is empty <a href=""> goes to home page. Thanks in advance
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
I think you can not. The browsers always leads to the same page. If you are generating links in controller, just check if every anchor has its value, even the wrong one, which will lead to 404 error message page. The same if you are handling the users input. You can replace empty values with "404", for example to "<a href="404">Some link</a>:
PHP Code: $input = '<a href="">Some link</a>';
An empty href="" will just link to the page you are on. If you are on the homepage already, that's why the link keeps going there. You actually have to link to a page that does not exist to get a 404.
So if you just installed CI, have a link to href="<?php echo site_url('welcome/does-not-exist'); ?>" for example. |
Welcome Guest, Not a member yet? Register Sign In |