1

I am creating a website in Codeigniter. This is very common issue I know and there are lots of solutions on Stack Overflow. I try almost all but nothing is helpful for me.

I just want to remove index.php from my url. Anybody please tell me how can I do it?

I have removed index.php from the config file's $config['index_page'] section

I also checked $config['uri_protocol'] = 'AUTO'; mode try both mode auto and REQUEST_URI.

My .httaccess file structure right now is this:

<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>

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

Can anybody please tell me how to do it?

2
  • @RiggsFolly can you update your links codeigniter.com/docs you will find now old and new user guide ellislab does not deal with CI Any more Commented May 10, 2016 at 9:31
  • @wolfgang1983 ok thanks for the info. Pity the search engines dont seem to have caught up with this change Commented May 10, 2016 at 9:57

5 Answers 5

0

=> Change in config file :-

$config['base_url'] = 'http://123456/proj/';
$config['index_page'] = '';

=> change in .htaccess file :-

RewriteEngine on
RewriteCond $1 !^(index\.php|
(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]
Sign up to request clarification or add additional context in comments.

1 Comment

works now.. there was little issue the .httacess file was in application folder I place that in root folder of project now its work for me thanks
0

$config['uri_protocol'] should be REQUEST_URI and then .htaccess as follows

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

1 Comment

0

I have the following and works fine for me:

DirectoryIndex index.php
RewriteEngine on

RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]

Comments

0
  1. Change the config file like this:

$config['index_page'] = ''; $config['uri_protocol'] = 'AUTO';

  1. Use the following .htaccess:

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

Note: .htaccess vary depending on server. In some server (e.g.: Godaddy) need to use the following .htaccess:

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

Comments

0

try this ...

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

Rewrite Base /music is your folder name

2 Comments

added but not working I badly want its solution. I try almost everything but I am not able to remove index.php

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.