CodeIgniter Forums
How to remove index.php from URL - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to remove index.php from URL (/showthread.php?tid=53342)



How to remove index.php from URL - El Forum - 07-19-2012

[eluser]justjiten[/eluser]
I am new to CI and using the version 2.1.2, I am trying it in my local server, I want to remove the index.php from my url, currently it is coming like http://localhost/ci/index.php/welcome.

I want this like http://localhost/ci/welcome. I am trying from last 2days but I am unable to get it correct. Please help me to set it right.


How to remove index.php from URL - El Forum - 07-19-2012

[eluser]Aken[/eluser]
https://www.google.com/search?btnG=1&pws=0&q=codeigniter+remove+index.php


How to remove index.php from URL - El Forum - 07-19-2012

[eluser]justjiten[/eluser]
Thanx Aken for your quick reply, but I already tried these things, these are not working in my case. I am new to CI please help me. my .htaccess file is like below

Code:
RewriteBase /ci/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [NC,L,QSA]



How to remove index.php from URL - El Forum - 07-19-2012

[eluser]InsiteFX[/eluser]
If you are running Windows it will show index.php the first time after that it will be removed.



How to remove index.php from URL - El Forum - 07-19-2012

[eluser]justjiten[/eluser]
Yes I am working on XAMPP in Windows. but the index.php is not removed at all.
Code:
http://localhost/ci/index.php/welcome

working fine, but when I type
Code:
http://localhost/ci/welcome

It is showing the error404 Object Not Found.

I have set config.php like
Code:
$config['base_url'] = 'http://localhost/ci/';
$config['index_page'] = ' ';
$config['uri_protocol'] = 'REQUEST_URI';

autoload.php like


Code:
$autoload['libraries'] = array('database');
$autoload['helper'] = array('url','form');

and routes.php like

Code:
$route['default_controller'] = "welcome";
$route['404_override'] = '';

My .htaccess file is like

Code:
RewriteBase /ci/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [NC,L,QSA]

please help me to remove index.php from url, I am using CI version 2.1.2


How to remove index.php from URL - El Forum - 07-20-2012

[eluser]justjiten[/eluser]
It works for me, what I did is Ichange the location of the .htaccess file, earlier my file structure was
Code:
/ci
  /application
   /.htaccess
  /system
  /index.php

after that I changed my file structure to
Code:
/ci
  /application
  /system
  /index.php
  /.htaccess

I put the .htaccess file at the same place where index.php is present

and my .htaccess file is like
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]


Now it solves my problem. Thanx for your help.


How to remove index.php from URL - El Forum - 07-20-2012

[eluser]InsiteFX[/eluser]
You need to add this:
Code:
RewriteBase On

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



How to remove index.php from URL - El Forum - 07-20-2012

[eluser]justjiten[/eluser]
It works for me, what I did is Ichange the location of the .htaccess file, earlier my file structure was
Code:
/ci
  /application
   /.htaccess
  /system
  /index.php

after that I changed my file structure to
Code:
/ci
  /application
  /system
  /index.php
  /.htaccess

I put the .htaccess file at the same place where index.php is present

and my .htaccess file is like
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]


Now it solves my problem. Thanx for your help.[/quote][/code]


How to remove index.php from URL - El Forum - 07-26-2012

[eluser]Unknown[/eluser]
Hi Guys

My .htaccess file looks something like this

>>>>>>>>>>


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


>> n still when I try to acess like http://localhost/CodeIgniter/welcome
Its showing not found.. Sad

i have added the .htacess i root folder..
Can anyone help me in this regards..