简体   繁体   中英

Index.php remove from url is not working in 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. 在此处输入图片说明

在此处输入图片说明

在此处输入图片说明 Any suggestion ?? Thank you

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM