Codeigniter 2 on IIS with web.config file

前端 未结 5 2051
长发绾君心
长发绾君心 2020-12-01 17:04

I have a codeigniter app working fine locally with WAMP. However, I am having trouble getting it to work on an IIS server. Please note that I do not want to enable query str

5条回答
  •  难免孤独
    2020-12-01 18:02

    Okay!

    Recently I had made an admin control panel with CI and grocery crud . It was working great with WAMP on my local server with a pretty URL and redirection. I was talking about the CI is the best framework I had ever work. It’s so easy to use and very well documented Cheers!! to CodeIgniter.

    But when I had to move my admin panel on IIS server 7.XX then seems my nightmare starts. Everything was stopping No redirection, No error display nothing was happening. I was so scared of why it’s happening. I dig Google, stack overflow, CI forum for almost 6 hours. I didn't receive anything from anywhere. I was so sad :(

    I can’t think about what I should do. Then, I have made myself cool and calm and start to review everything step by step that is here:

    1.    Set error reporting on
    2.    Check PHP info
    3.    Check redirect/rewrite
    4.    Check MySQL/MySQLi extension loaded or not in IIS server
    5.    Converted my .htaccess file rule with web.config rule (Really helped me)
    6.    Put web.config file in the main directory (CI working folder) not in the root folder
    

    How to convert .htaccess in web.config?

    Then, I found that everything is correct except ‘mysqli’ extension was not loaded on IIS Server and my database config credentials were wrong. Then I made changes in php.ini (check’ phpinfo()’ to find php.ini path on IIS Server) line no 881 with uncomment extension=php_mysqli.dll.

    Here is my CI config settings:

    $config['base_url']    = '';
    $config['index_page'] = '';
    $config['uri_protocol']    = 'REQUEST_URI';
    

    After that, reopen my CI admin panel now!!!!!! Everything wow!! wow!! working like charm :) he he he…. I was so happy :) :)

    Here is my web.config file

    
    
        
            
                
                    
                        
                        
                            
                        
                        
                    
                    
                        
                        
                            
                        
                        
                    
                    
                        
                        
                            
                        
                        
                    
                    
                        
                        
                            
                            
                        
                        
                    
                
            
        
    
    

    Here is my pretty URL type

    https://mysite.abc.com/administrator/admin/showUsers
    
    the administrator is my  admin folder
    
    admin is my controller
    
    and showUsers in my controller method
    

    Hope my bad experience will help somebody :)

提交回复
热议问题