Welcome Guest, Not a member yet? Register   Sign In
Cannot remove index.php in Codeigniter 2.1.3
#1

[eluser]huskyfritz[/eluser]
Hello guys, I want to remove index.php in my url but the solutions I searched from the net is not working. I also look in the documenation of codeigniter but still not working.

I am using Codeigniter 2.1.3.

I changed
Code:
$config['index_page'] = 'index.php';
into
Code:
$config['index_page'] = '';

I placed my .htaccess file under application folder with the lines of code:
Code:
# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>

When I am trying to browse the url(w/o index.php): domain/controller/ I get a 404 page which the browser cannot locate the controller.

Please help me because I am beginner in this framework.

Thanks! Smile
#2

[eluser]Aken[/eluser]
The rewrite .htaccess goes in the same folder as your index.php. The application folder has its own .htaccess already that you usually should never modify.
#3

[eluser]huskyfritz[/eluser]
Thanks Aken! its now working. Smile
#4

[eluser]Unknown[/eluser]
I have to remove index.php from my url as well as i am using SSL connection for all pages so i write .htacces file like following way. i write .htaccess file in Docuemtroot directory where code igniter installed and one another .htaccess already in application directory. I followd this steps but my problems not solved.

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

RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ https://<IP>/$1 [L]

If i write code for rewriting to https in .htacess of application directory then its rewriting all http request to https ..thats fine for me ..But i also want to remove index.php..But if i append code in .htaccess for removing index.php doesnt work for me.




Theme © iAndrew 2016 - Forum software by © MyBB