0

I have URL

http://localhost:82/project/index.php/home

I want to remove index.php from above url.

Like this : http://localhost:82/project/home

I have used many solution

1) I have remove index.php from config.php file :

$config['index_page'] = '';

2) change "uri_protocol" in config.php file :

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

My htaccess :

RewriteEngine On
RewriteBase /project/
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index\.php|images|js|uploads|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Anybody master here to solve my question ? Thanks in advance.

1
  • have you set base_url correctly? and default controller? what is the error you are experiencing. Commented Sep 27, 2018 at 0:59

4 Answers 4

1

use this Codeigniter .htaccess file and install it to your root app.

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

Like this one...

project_name
    -application
    -assets
    -system
    -user_guide
    -.htaccess // like this one
Sign up to request clarification or add additional context in comments.

Comments

1

Try To Use This

RewriteEngine on
#RewriteBase /project/
RewriteCond $1 !^(index\.php|images|admin|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|admin|robots\.txt)
RewriteRule .* index.php/$0 [PT,L]

I use it and work on me. Thank You

Comments

1

Set your base URL in config as

$config['base_url'] = 'http://localhost:82/project/'

In your .htaccess, Try with this, I have used this in my CI projects.

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

Place this file in your project folder.

Folder structure

Comments

1

If you are using Apache Server, you must do mod_rewrite enabled. And then modify your .htaccess file with the code below.

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

For more information, visit here

Try similar question here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.