How to remove “index.php” in codeigniter's path

后端 未结 27 1356
盖世英雄少女心
盖世英雄少女心 2020-11-22 07:17

How do I remove the \"index.php\" sticking out in every path in codeigniter somewhere in the center? I want clean non index.php-fied URLs?

相关标签:
27条回答
  • 2020-11-22 08:19
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* /codeigniter/index.php/$0 [PT,L]
    

    after changing RewriteRule .* index.php/$0 [PT,L] with the project folder name "codeigniter".its working for me. Thanks guys for your support.

    0 讨论(0)
  • 2020-11-22 08:20

    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]
    
    0 讨论(0)
  • 2020-11-22 08:22

    Hi This one worked me

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

    as well as this

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

    where the folder is the name of the subfolder if this codeigniter application is hosted as a subdomain e.g domainname/folder/index.php.

    Hope that works for you. Thanks.

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