I am developing a web site using CodeIgniter. I have already have a custom 404 Error Page. But now i want to add a custom page for 403 Forbidden Error. Can you help me?
I have used this code for 404 $route['404_override'] = 'Error';
            Asked
            
        
        
            Active
            
        
            Viewed 3,359 times
        
    1
            
            
         
    
    
        Vinil Chandran
        
- 1,563
- 1
- 19
- 33
- 
                    http://stackoverflow.com/a/5061734/3419997 – turtle Oct 24 '14 at 04:22
1 Answers
0
            
            
        I havent used codeigniter for a while... So check \application\errors\error_404.php and modify accordingly. let me know if it doesnt work. I check my previous works and see how i managed to customize it.
 
    
    
        Muhammad Hassaan
        
- 7,296
- 6
- 30
- 50
 
    
    
        Abhishek Salian
        
- 928
- 2
- 10
- 27
- 
                    i couldn't understand what you mean. So please explain briefly, because i am not genius in php and codeigniter. – Vinil Chandran Oct 24 '14 at 06:58
- 
                    Create a new controller/method for 403 error page and when ever needed set a redirect to this controller. in this controller make sure u set headers $this->output->set_status_header('403'); and then load a custom view of ur choice. – Abhishek Salian Oct 24 '14 at 07:07
- 
                    I mean to find a methord to avoid putting manually where to show '403 Forbidden Error'. In the case of 404 File Not Found Error there is an option to rout to the 404_page controller by `$route['404_override'] = 'Error';` this code. I want to know is there any method similar to this. – Vinil Chandran Oct 24 '14 at 10:27
- 
                    sorry i dont think there is any function out of the box to override. only way to do is create a custom route and then use route to display 403 page where ever needed, also dont forget to set 403 header. – Abhishek Salian Oct 27 '14 at 00:40