CodeIgniter removing index.php from url

前端 未结 30 1864
[愿得一人]
[愿得一人] 2020-11-21 11:51

My current urls look like this [mysite]index.php/[rest of the slug].
I want to strip index.php from these urls.

mod_rewrite

30条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-21 11:56

    Use this code. Change the 2nd line as you have your folder name. Where index.php file and folders application, system folder lie. Mostly problems happen due to second line. we don't configure the folder name where project is place. Important is 2nd line. This is simple to remove the index.php. RewriteEngine on RewriteBase /project_folder_name RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php/$0 [PT,L]

    #RewriteEngine on
    #RewriteCond $1 !^(index\.php|images|robots\.txt)
    #RewriteRule ^(.*)$ index.php/$1 [L]    
    

    Go to controller/config.php file.

    config['index_url']='';

    Reference for more study.

    https://ellislab.com/expressionengine/user-guide/urls/remove_index.php.html

    https://ellislab.com/blog/entry/fully-removing-index.php-from-urls

提交回复
热议问题