Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] index.php removal instructions aren't exactly working
#1

[eluser]Jakobud[/eluser]
First of all, I did a search for this type of topic and found a lot of them but nothing seemed to describe my issue.

Yes I have read the User Guide and followed the simple instructions to add this to my .htaccess:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Simple enough. I tried testing my pages from the blog video tutorial:

Code:
http://www.mydomain.com/blog

It works! Awesome...

But then I notice that when I mouseover my comment links, it wants to take me to this type of url:

Code:
http://www.mydomain.com/index.php/blog/comments/1

Hmmm... I click on those links and thats exactly the URL it takes me to. So apparently the .htaccess rule doesn't seem to work except for the primary (index) function in the Blog class?

Well I continued reading and looking at threads and found someone discussing a setting in the config.php. So I found this:

Code:
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = "index.php";

Oh okay, so I just change it to this:

Code:
$config['index_page'] = "";

Sounds like that should work. Now I go back to my blog:

Code:
http://www.mydomain.com/blog

First page comes up easy enough. Mouse over my comment links and I see this:

Code:
http://www.mydomain.com/blog/comments/1

So far so good. I click my comment links and...

Takes me here:

Code:
http://www.mydomain.com/blog/comments/1

EXCEPT its still showing the blog view instead of the comment view...

So I am stumped as to why this isn't working for me. Any thoughts or hints or can anyone point me in the right direction?
#2

[eluser]Ben Edmunds[/eluser]
Are you loading the correct view when you do $this->load->view('comments');?

Echo something from your controller to verify where you're at.
#3

[eluser]Jakobud[/eluser]
Here is my comments function

Code:
function comments()
    {
        $data['title'] = "My Comment Title";
        $data['heading'] = "My Comment Heading";

        $this->db->where('entry_id', $this->uri->segment(3));
        $data['query'] = $this->db->get('comments');
        
        $this->load->view('comment_view', $data);
    }

I followed the tutorial pretty much to the t. First of all, should I leave the

Code:
$config['index_page'] = "";

or set it back to its default value?

Everything works perfectly just like in the video tutorial until I try to get rid of the index.php. It's only then when stuff gets weird.
#4

[eluser]Ben Edmunds[/eluser]
Yes leave

Code:
$config['index_page'] = "";

run php_info() and make sure mod_rewrite is enabled.
#5

[eluser]Unknown[/eluser]
hi, this site might be helpful... remove index.php
#6

[eluser]Jakobud[/eluser]
Thanks solidlucky,

Those instructions worked perfectly. The trick that did it for me was setting

Code:
$config['uri_protocol']    = "REQUEST_URI";

It wasn't working properly until I made that change. This should be in that wiki and in the User Guide imho.

Thanks guys.
#7

[eluser]jedd[/eluser]
[quote author="Jakobud" date="1257201453"]
It wasn't working properly until I made that change. This should be in that wiki and in the User Guide imho.
[/quote]

It's already in the wiki. Specifically the FAQ. Admittedly it's in the 'site relocations, moves, changes' bit - but I'm not sure we need (yet another) discussion about how to work through resolving index.php problems.

I'm open to suggestions on this one. I feel that the number of forum messages that have a subject that contains the string 'index.php', most of which get resolved (even if posters never bother to change the topic-title to include [ SOLVED ] as a matter of courtesy) by fiddling with the uri_protocol is sufficiently high as to make it almost impossible to not discover this trick.

And of course, the config.php file - which you'd have worked through when you installed, presumably - does suggest that the URI PROTOCOL section be revisited if your 'links do not seem to work'.




Theme © iAndrew 2016 - Forum software by © MyBB