Codeigniter URL rewrite to remove index.php

前端 未结 1 587
滥情空心
滥情空心 2021-01-21 12:06

First of all, i have tried the suggestion specified in here:

  • CodeIgniter removing index.php not working
  • codeignitor: Remove index.php not working
1条回答
  •  迷失自我
    2021-01-21 12:30

    OK, You mentioned lot of Stack links which related to your question.

    Change this settings

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

    and add this in .htaccess

    
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php/$1 [L] 
    
    

    Note: Some time in localhost index.php will not removed.

    and to include your css/js/images

    CSS:
    JS :
    Img:

    So file structure would be

    - application
    - assets
      - style
         - material-design-icons.css
         - font.css
         - app.css
      - js
         - easing.js
      - image
         - logo.jpg
    - index.php
    - .htaccess(Post in my code)
    

    EDIT 01

    In config/routes.php

    $route['default_controller'] = "";//give default controller name
    $route['404_override'] = '';
    

    0 讨论(0)
提交回复
热议问题