Remove “index.php” from URL - Codeigniter

前端 未结 12 1206
清酒与你
清酒与你 2020-12-03 16:05

I\'ve looked in the documentation of Codeigniter of removing the index.php from the URL when accessing different views, the code shows how to remove it with apa

12条回答
  •  广开言路
    2020-12-03 16:10

    To remove index.php from URL just add

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* index.php/$0 [PT,L]
    

    in the .htaccess file and move the .htaccess file near to index.php location

    /var/www/CodeIgniter/index.php
    /var/www/CodeIgniter/.htaccess
    

    in config.php in config folder set

    $config['index_page'] = '';
    

提交回复
热议问题