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

[eluser]mi6crazyheart[/eluser]
Here is my current .htaccess
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /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>

& my problem is if i remove index.php from url like following example..
Code:
http://localhost/vb/account/forgetPassword
It's not working. Showing 404 file not found error.

But, when i include index.php as in following example in the url
Code:
http://localhost/vb/index.php/account/forgetPassword
It's started working.

I've also checked my apache for mod_rewrite setting & i think mod_rewrite has enabled. Here is a screen shot of my apache2handler config which i got by using php's "echo phpinfo()". I really don't know it's a right way to check for mod_rewrite enable or not but, from some web tuto i got this technique.
#12

[eluser]jblack199[/eluser]
localhost has always had issues with it for some reason. When I ran my localhost I couldnt remove it otherwise it would break everything, but once I moved my project to my shared environment I was able to.. something to do with configurations and stuff like that i'm unsure but yeah.
#13

[eluser]Aken[/eluser]
CI works fine on localhost if you set it up right.

Are you getting a CodeIgniter 404 page or an Apache 404 page? That will tell us more information.

Also remember to change your 'index_page' config item to be empty:
Code:
$config['index_page'] = '';
#14

[eluser]jblack199[/eluser]
[quote author="Aken" date="1313025731"]CI works fine on localhost if you set it up right.

Are you getting a CodeIgniter 404 page or an Apache 404 page? That will tell us more information.

Also remember to change your 'index_page' config item to be empty:
Code:
$config['index_page'] = '';
[/quote]

Didnt mean CI didnt work on localhost, meant the .htaccess to remove the index.php didnt work right on localhost for me no matter how i tried to configure it all.
#15

[eluser]Aken[/eluser]
Well, yeah that's what I meant - CI + htaccess overall. I'm sorry you couldn't get it to work. I bet you could figure it out with some help from these forums, maybe Stack Overflow + other online resources, etc. I know I had to look up a couple goofy Apache configurations to figure out why some things didn't work (for instance, mine had Allow Escaped Slashes turned off, so I couldn't use url-encoded links in my application).
#16

[eluser]jblack199[/eluser]
Yeah apache and the many configurations is very odd... I often think postfix is easier to configure than apache.. but no loss for me personally on the localhost not working, I just have an extra step of remembering to upload each file when i'm done with it..
#17

[eluser]Aken[/eluser]
Yeah, if you set it up correctly you just need to add the .htaccess file and change the config.php file to remove the index page.
#18

[eluser]mi6crazyheart[/eluser]
@Aken
Ya, i've already done that
Code:
$config['index_page'] = '';

& also tried this
Code:
[$config['uri_protocol'] = 'REQUEST_URI';

with all available options. But, nothing is working accordingly.

Ya, i'm getting that 404 file not found error from Apache not from CI...
#19

[eluser]mi6crazyheart[/eluser]
Don't know why, but i'm also feeling like it's my "mod_rewrite" might've not working properly. I've just google a bit about this "mod_rewrite" & i got couple of questions where people say.. their apache showing "mod_rewrite" has enable in their localhost but still, it's not working accordingly as it need to do...
#20

[eluser]appleboy[/eluser]
Could you try my solution above article?

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




Theme © iAndrew 2016 - Forum software by © MyBB