How to remove index.php from Codeigniter URL or .htaccess and codeigniter not working?


After after visiting so many sites article i solve this problem that why its not working with index.php or why sub page links are not working without index.php

I think all article has same copy and paste code on their website that's why you are wondering here and there ...
try this code i think this will definitely work for you

if your site is uploaded on root of website than
open you htaccess from you root
and paste this code on you htaccess

Options +FollowSymLinks All -Indexes
Options All -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]



if your site is inside in sub-folder of any site like www.site.com/yoursitefolder/
so you have to paste this code on your htaccess file of your codeigniter site


Options +FollowSymLinks All -Indexes
Options All -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteBase /yoursitefolder
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

and change somthing in your config.php file too
application/config/config.php
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

// Only For Localhost
If the problem still exist

Configure mod_rewrite in httpd.conf

  1. Locate the httpd.conf file in the Apache sub-directory C:\xampp\apache\conf\httpd.conf
  2. Uncomment the following line from: #LoadModule rewrite_module modules/mod_rewrite.so
    to
    LoadModule rewrite_module modules/mod_rewrite.so
  3. Save the changes to the file

Comments

  1. Thanks for the details about remove Index.php from Codeigniter URL by providing a brief details and allowing the client know about it.

    ReplyDelete
  2. You are right after visiting so many sites I just found that there is same coding on every II site. And implementing them is just wastage of time. But the above I found is good working for me.
    Thanks!

    ReplyDelete
  3. thank you so much this is really works for me

    ReplyDelete

Post a Comment