CodeIgniter removing index.php from url

前端 未结 30 1472
[愿得一人]
[愿得一人] 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条回答
  •  梦毁少年i
    2020-11-21 12:00

    Step 1 => Place your .htaccess file in root folder where application and system folders exist.

    Step 2 => If your web path using sub-folder like - yourdomain.com/project/ - then use following code in htaccess file

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

    If your web path using root-folder like - yourdomain.com - then use following code in htaccess file

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

提交回复
热议问题