从URL中删除Index.php在CI 3中不起作用

I have tried a lot to remove index.php from the url . Its not working at all.

In config.php

$config['index_page'] = '';

$config['uri_protocol'] = 'REQUEST_URI';

Then put this below code in .htaccess of my project root.

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

I have tried ,its throwing page not found errors only. enter image description here

enter image description here

enter image description hereAny suggestion ?? Thank you

Your base URL is not the base domain name, so modify your .htaccess file and add the following:

RewriteBase /cloud

This should fix your issues.

You need to change config.php and .htaccess file.

Changes in application/config/config.php

$config['index_page'] = ""; // And Remove index.php

Changes in .htaccess

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
#RewriteRule ^(.*)$ index.php?/$1 [QSA,L]

Make Sure

  1. Your .htaccess must under cloud directory.

  2. Rewrite module must be enabled in Apache.

try this ,
Changes in .htaccess

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

Make sure your RewriteEngine is on in apache conf file if not then follow this link

How to enable mod_rewrite for Apache 2.2