Welcome Guest, Not a member yet? Register   Sign In
How to remove index.php from URL
#1

[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.
#2

[eluser]Aken[/eluser]
https://www.google.com/search?btnG=1&pws...+index.php
#3

[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]
#4

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

[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
#6

[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.
#7

[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]
#8

[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]
#9

[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..




Theme © iAndrew 2016 - Forum software by © MyBB