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

[eluser]mi6crazyheart[/eluser]
Ok!!! i know it's pretty old question & there are a lot of info available on CI forum.. but, i really now in trouble in this particular issue(remove index.php).

I tried out a lot tweaks & tricks available over in forum but yet have not get any luck. Hope, u guys give me some help to figure out this problem.

Here is some info about my dev. enviroement...

OS: ubuntu 10.04 LTS
Done apache 2 mod_rewrite by following this tuto : http://goo.gl/tglai

My .htaccess file
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /http://localhost/vb/

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /vb/index.php?/$1 [L]
    
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /vb/index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

vb : Root folder name where i've stored all my codeigniter files

Update my config.php by making following changes
* $config['index_page'] = '';
* $config['uri_protocol'] = 'REQUEST_URI';


I'm using sub-folders to organize my controller files. Don't know, whether this has any links to that .htaccess or not.


Regards
Suresh
#2

[eluser]praveens[/eluser]
Try this one

Code:
RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^(index \.php|check_images|captcha|js|css)
    RewriteRule ^(.*)$ index.php?/$1 [L]

Cheers!!!!!!!
#3

[eluser]mi6crazyheart[/eluser]
@Praveens Nops buddy, not working...
#4

[eluser]LuckyFella73[/eluser]
Afaik the "RewriteBase" has to be a relative path.

Did you try all possible types of $config['uri_protocol'] ?
#5

[eluser]mi6crazyheart[/eluser]
@luckyfella73

I've changed that "RewriteBase" to

Code:
RewriteBase /vb/

& tried it with all the possible "url_protocol" but still now no luck...
#6

[eluser]IgnitedCoder[/eluser]
Try this one on for size, works for me:

Code:
ErrorDocument 404 /index.php

# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
# There is no end quote below, for compatibility with Apache 1.3.
ErrorDocument 404 "The requested file favicon.ico was not found.
</Files>

# Set the default handler.
DirectoryIndex index.php

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond %{ENV:REDIRECT_STATUS} 100
RewriteRule ^(.*)$ /index.php/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteCond %{ENV:REDIRECT_STATUS} 100
RewriteRule ^(.*)$ /index.php/$1 [L]

#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{ENV:REDIRECT_STATUS} 100
RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>
#7

[eluser]hellogxp[/eluser]
<IfModule mod_rewrite.c>

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ /index.php/$1 [QSA,PT,L]

</IfModule>
#8

[eluser]danmontgomery[/eluser]
Let's all stop posting random htaccess files, especially ones that clearly won't work for him.

@mi6crazyheart, can you please post your current htaccess (you were correct that RewriteBase should be /vb/), as well as an actual description of what your error is?
#9

[eluser]appleboy[/eluser]
Hi,

Try the following code of .htaccess on your Ubuntu

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

[eluser]IgnitedCoder[/eluser]
@noctrum, helping out is what makes a community a community, asking folks not to post files in the spirit of good intentions is BS. In future be more polite and remember we're all here to help. So help the guy out but don't criticize others for trying to do the same thing.




Theme © iAndrew 2016 - Forum software by © MyBB